
85
void
loop
() {
if
(
irrecv
.
decode
( &
results
) ) {
/* Read the value received by the infrared */
if
(
results
.
value
==
advence
) {
/* Judgment on the received value, if this value
is advence, execute the following {} command, here is the forward instruction. */
int
val
=
150
;
analogWrite
(
M1
,
0
);
analogWrite
(
E1
,
val
);
//the speed value of motorA is val
analogWrite
(
M2
,
0
);
analogWrite
(
E2
,
val
);
//the speed value of motorB is val
delay(500);irrecv
.
resume
();
// Receive the next value
}
if
(
results
.
value
==
expedite1
) {
/*Judgment on the value received, if this value
is expedite1, execute the command in {} below, here is the acceleration 1 command.
*/
int
val
=
200
;
analogWrite
(
M1
,
0
);
analogWrite
(
E1
,
val
);
//the speed value of motorA is val
analogWrite
(
M2
,
0
);
analogWrite
(
E2
,
val
);
//the speed value of motorB is val
delay(500);irrecv
.
resume
();
}
if
(
results
.
value
==
expedite2
) {
/*Judgment on the received value, if the value
is expedite2,execute the command {} below,here for the acceleration 2 command. */
int
val
=
255
;
analogWrite
(
M1
,
0
);
analogWrite
(
E1
,
val
);
//the speed value of motorA is val
analogWrite
(
M2
,
0
);
analogWrite
(
E2
,
val
);
//the speed value of motorB is val
delay(500);
irrecv
.
resume
();
}
if
(
results
.
value
==
stop
) {
/* To judge the value received, if this value is stop,
execute the command in the following {}, here is the stop instruction. */
Summary of Contents for Hummer-Bot-1.0
Page 1: ...Hummer Bot 1 0 Instruction Manual V 2 0 ...
Page 18: ...15 Step4 You need to install motors Figure 3 1 5 Schematic diagram of motor installation ...
Page 50: ...47 Figure 3 2 15 Diagram of Data without Obstacles ...
Page 83: ...80 Test code Path hummer bot Lesson ModuleDemo IrkeyPressed IrkeyPressed ino ...