切诺基与UNO无法正常通信
买了一个切诺基的小车,用小米UNO来通讯,但程序上传后小车没动,是什么情况?帮忙看下int speedPin_M1 = 5; //M1 Speed Control
int speedPin_M2 = 6; //M2 Speed Control
int directionPin_M1 = 4; //M1 Direction Control
int directionPin_M2 = 7; //M1 Direction Control
void setup(){
}
void loop(){
carAdvance(100,100);
delay(1000);
carBack(100,100);
delay(1000);
carTurnLeft(250,250);
delay(1000);
carTurnRight(250,250);
delay(1000);
}
void carStop(){ //Motor Stop
digitalWrite(speedPin_M2,0);
digitalWrite(directionPin_M2,LOW);
digitalWrite(speedPin_M1,0);
digitalWrite(directionPin_M1,LOW);
}
void carAdvance(int leftSpeed,int rightSpeed){ //Move FORkward
analogWrite (speedPin_M2,leftSpeed); //PWM Speed Control
digitalWrite(directionPin_M2,LOW);
analogWrite (speedPin_M1,rightSpeed);
digitalWrite(directionPin_M1,HIGH);
}
void carBack(int leftSpeed,int rightSpeed){ //Move BACKrward
analogWrite (speedPin_M2,leftSpeed);
digitalWrite(directionPin_M2,HIGH);
analogWrite (speedPin_M1,rightSpeed);
digitalWrite(directionPin_M1,LOW);
}
void carTurnLeft(int leftSpeed,int rightSpeed){ //Turn Left
analogWrite (speedPin_M2,leftSpeed);
digitalWrite(directionPin_M2,HIGH);
analogWrite (speedPin_M1,rightSpeed);
digitalWrite(directionPin_M1,HIGH);
}
void carTurnRight(int leftSpeed,int rightSpeed){ //Turn Right
analogWrite (speedPin_M2,leftSpeed);
digitalWrite(directionPin_M2,LOW);
analogWrite (speedPin_M1,rightSpeed);
digitalWrite(directionPin_M1,LOW);
}@luna @hnyzcj @Ash 等人帮看下,比较急
只闪灯,小车不走,连轮子都不动
这什么东东......
最好发我QQ上
1973742214
QQ:1973742214
沙发
尽快回帖 凳纸,快回快回快回 我的建议之一:把TX,RX先拔掉,重新上传程序观察一下; 若仍没有动静,则先断电,恢复接入TX,RX,通电 安卓机器人 发表于 2018-4-6 22:25
我的建议之一:把TX,RX先拔掉,重新上传程序观察一下; 若仍没有动静,则先断电,恢复接入TX,RX,通电 ...
我试试,谢谢 不好意思回复晚了,问题解决了吗? 这个连线实在太乱,线捋一捋,看一下排线是否正常,另外记得要共地!!!! 关键是连线。 代码看上去没问题。 谢谢,我马上完成了,一会再发帖{:5_118:} 可怜我一介书生,无产阶级,压岁钱说花没就没了{:5_155:} 问题解决了吗
页:
[1]