问题描述
我正在尝试创建我自己的代码来控制伺服而不使用servo.h库,我能够使用代码打击创建PWM信号,并且我能够移动到任何角度的伺服,但是我的问题是速度,伺服具有相同的速度,我正在构建一个机器人,我想控制我的速度。有人可以帮忙吗? ,我尝试使用延迟,但速度始终相同。
int pinservo =9;
void setup() {
// put your setup code here,to run once:
pinMode(pinservo,OUTPUT);
}
void loop() {
for (int i=400;i<2500;i++){ // 400 micro-second for 0 degree,2500 micro-seconds for 180 degree
digitalWrite(pinservo,HIGH);
delayMicroseconds(i);
digitalWrite(pinservo,LOW);
delayMicroseconds(20000-(i));
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)