楼主: Jane
|
[入门教程] DFR0100 Arduino教程 12-- 可控舵机 |
#include <Servo.h> Servo myservo; int potpin = 0; int val; int ledPin = 5; void setup() { myservo.attach(9); pinMode(ledPin, OUTPUT); } void loop() { val = analogRead(potpin); val = map(val, 0, 1023, 0, 179); myservo.write(val); delay(15); digitalWrite(ledPin,HIGH); delay(500); digitalWrite(ledPin,LOW); delay(200); } 为撒 加了个闪灯程序 舵机就疯了 ? |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed