31433| 10
|
[讨论] 切诺基与UNO无法正常通信 |
6 创造力 | 回复本帖可获得 2 创造力奖励! 每人限 1 次 |
买了一个切诺基的小车,用小米UNO来通讯,但程序上传后小车没动,是什么情况? 帮忙看下[mw_shl_code=cpp,true]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); }[/mw_shl_code]@luna @hnyzcj @Ash 等人帮看下,比较急 只闪灯,小车不走,连轮子都不动 这什么东东...... 最好发我QQ上 [qq]1973742214[/qq] |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed