if(results.value
execute the command in the following {}, here is the instruction to the left. * /
{
int
val=150;
analogWrite
(M1,0);
analogWrite(E1, val);
analogWrite
(E2,0);
analogWrite(M2, val);
delay(500);
/ * Rotate 500ms to the left and stop, otherwise the car will always
be spinning around. * /
analogWrite
(M1,0);
analogWrite(E1, 0);
analogWrite
(M2,0);
analogWrite(E2, 0);
analogWrite(A1,180);
irrecv.resume();
}
if(results.value
right, execute the command in the following {}, here is the command to the right. * /
{
int
val=150;
analogWrite
(E1,0);
analogWrite(M1, val);
analogWrite
(M2,0);
analogWrite(E2, val);
delay(500);
analogWrite
(M1,0);
analogWrite(E1, 0);
analogWrite
(M2,0);
analogWrite(E2, 0);
analogWrite(A2,180);
irrecv.resume();
}
if(results.value
execute the command {} below, here for the back instruction. * /
{
int
val=150;
analogWrite
(E1,0);
== left)
/ * Judgment on the received value, if the value is left,
//the speed value of motorA is val
//the speed value of motorB is val
//the speed value of motorA is 0
//the speed value of motorB is 0
== right)
/ * Judgment on the received value, if the value is
//the speed value of motorA is val
//the speed value of motorA is val
//the speed value of motorA is 0
//the speed value of motorB is 0
== back)
/ * Judgment on the received value, if the value is back,
85
Need help?
Do you have a question about the Hummer-Bot and is the answer not in the manual?