handle is pressed. Through the "fourth step in the experimental step" we can get the
code of all the buttons * /
{
int
val=200;
analogWrite
(E1,0);
analogWrite(M1, val);
analogWrite
(M2,0);
analogWrite(E2, val);
delay(200);
analogWrite
analogWrite(E1, 0);
analogWrite
(M2,0);
analogWrite(E2, 0);
}
if(ps2x.Button(PSB_L2)||(ps2x.Button(PSB_PAD_LEFT)))
/ * If the received signal is PSB_L2 or PSB_PAD_LEFT, execute the command in {}, ie
turn left. The reason why two codes are used here is because we have set two keys on
the PS2 handle for turning left, Just press one of them to complete the turn left * /
{
int
val=200;
analogWrite
(M1,0);
analogWrite(E1, val);
analogWrite
(E2,0);
analogWrite(M2, val);
delay(200);
analogWrite(E1, 0);
analogWrite
(M2,0);
analogWrite(E2, 0);
}
if(ps2x.Button(PSB_PAD_DOWN))
command in {} to stop. * /
{
int
val=180;
analogWrite
(E1,0);
analogWrite(M1, val);
analogWrite
(E2,0);
analogWrite(M2, val);
}
//the speed value of motorA is val
//the speed value of motorA is val
(M1,0);
//the speed value of motorA is val
//the speed value of motorA is val
analogWrite
(M1,0);
/ * If the received signal is PSB_PAD_DOWN, execute the
//the speed value of motorA is val
//the speed value of motorA is val
94
Need help?
Do you have a question about the Hummer-Bot and is the answer not in the manual?