如何解决Arduino伺服不旋转所有齿轮
我已经创建了使用arduino和IR Remote旋转9g Microservo的代码。每当我将代码上传到arduino时,微型伺服器中的两个齿轮就开始旋转而没有输入,但它们却不旋转其他齿轮或伺服器的头部。按下IR遥控器上的正确按钮后,旋转齿轮不会改变,并且arduino上的其他位置也没有明显变化。
#include <IRremote.h>
#include <Servo.h>
#define FF22DD 0xA732
#define FF02FD 0xA732
int IRpin = 11; // pin for the IR sensor
IRrecv irrecv(IRpin);
decode_results results;
Servo myservo;
void setup() {
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop() {
if (irrecv.decode(&results)) {
irrecv.resume(); // Receive the next value
}
if (results.value == FF22DD) { // Value responding to VOL -
myservo.write(0);
delay(15);
}
if (results.value == FF02FD) { // Value responding to VOL +
myservo.write(30);
delay(15);
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。