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);
}
为撒 加了个闪灯程序 舵机就疯了 ? 不错不错 学习了,感谢分享!
页:
1
[2]