93
int
vb
;
int
KK
;
void
setup
()
{
Serial
.
begin
(
9600
);
error
=
ps2x
.
config_gamepad
(
11
,
7
,
8
,
4
,
true
,
true
);
/ * Set the receiving port on the Arduino * /
}
void
loop
()
{
ps2x
.
read_gamepad
(
false
,
vibrate
);
/ * Read the signal received by the receiver * /
if
(
ps2x
.
Button
(
PSB_L3
))
/ * If the received signal is PSB_L3, execute the command in
{}, ie stop, "PSB_L3" is the code returned when the button on the PS2 handle is
pressed, and through the "fourth step in the experimental step" we can get All key
coding * /
{
int
val
=
0
;
analogWrite
(
M1
,
0
);
analogWrite
(
E1
,
val
);
//the speed value of motorA is val
analogWrite
(
M2
,
0
);
analogWrite
(
E2
,
val
);
//the speed value of motorA is val
}
if
(
ps2x
.
Button
(
PSB_PAD_UP
))
/ * If the received signal is PSB_PAD_UP, execute the
command in {}, ie forward, "PSB_PAD_UP" is the code returned when the button on the PS2
handle is pressed, and through the "fourth step in the experimental step" we can obtain
All key coding * /
{
int
val
=
180
;
analogWrite
(
M1
,
0
);
analogWrite
(
E1
,
val
);
//the speed value of motorA is val
analogWrite
(
M2
,
0
);
analogWrite
(
E2
,
val
);
//the speed value of motorA is val
}
if
(
ps2x
.
Button
(
PSB_R2
)||(
ps2x
.
Button
(
PSB_PAD_RIGHT
)))
/ * If the received signal is PSB_R2 or PSB_PAD_RIGHT, execute the command in {}, ie,
turn right. The reason why two codes are used here is because we have set two buttons
on the PS2 handle for turning right, Just press one of them to complete the right turn
"PSB_R2 and PSB_PAD_RIGHT" is the code that is returned when the button on the PS2
Summary of Contents for Hummer-Bot
Page 1: ...Hummer Bot Instruction Manual Github https github com keywish keywish hummer bot...
Page 7: ...4...
Page 8: ...5...
Page 9: ...6...
Page 10: ...7...
Page 13: ...10 Fig 2 2 Several commonly usedArduino...
Page 15: ...12 After the completion as shown...
Page 16: ...13 The second step is to Welding wire on the motor...
Page 17: ...14 After the completion as shown...
Page 19: ...16 Fig 3 1 3 Diagram of Aluminum Alloy Bracket Installation...
Page 20: ...17 Fig 3 1 4 Diagram of Motor Installation Fig 3 1 5 Fixing Screw for Motor...
Page 24: ...21 Fig 3 1 10 Diagram of Wheel Installation Fig 3 1 10 Diagram of Wheel Screw Fixation...
Page 29: ...26 Fig 3 1 15 Diagram of Tracing Module Installation...
Page 30: ...27 Fig 3 1 16 Diagram of Screw Brackets Fig 3 1 17 The Back of Complete Installation...
Page 32: ...29 First install the screws on the UNO After the completion as shown...
Page 43: ...40 Fig 3 1 33 Diagram of Wires Arrangement Fig3 1 34 the Effect of Whole Assembly...
Page 56: ...53 Fig 3 2 11 Diagram of Data with Obstacles Fig 3 2 12 Diagram of Data without Obstacles...
Page 69: ...66 Fig 3 2 22 Diagram of Steering Gear Fig 3 2 23 Composition of Steering Gear...
Page 93: ...90 Fig 3 2 42 Receiving Head Position Fig 2 3 43 Installation of Receiving Head...