86
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 motorB is val
delay
(
500
);
irrecv
.
resume
();
}
if
(
results
.
value
==
left
) {
/* Judgment on the received value, if the value is left,
execute the command in the following {}, here is the instruction to the left. */
int
val
=
150
;
analogWrite
(
M1
,
0
);
analogWrite
(
E1
,
val
);
//the speed value of motorA is val
analogWrite
(
E2
,
0
);
analogWrite
(
M2
,
val
);
//the speed value of motorB is val
delay
(
500
);
/* Rotate 500ms to the left and stop, otherwise the car will always
be spinning around. */
analogWrite
(
M1
,
0
);
analogWrite
(
E1
,
0
);
//the speed value of motorA is 0
analogWrite
(
M2
,
0
);
analogWrite
(
E2
,
0
);
//the speed value of motorB is 0
analogWrite
(
A1
,
180
);
irrecv
.
resume
();
}
if
(
results
.
value
==
right
) {
/* Judgment on the received value, if the value is
right, execute the command in the following {}, here is the command to the right.
*/
int
val
=
150
;
analogWrite
(
E1
,
0
);
analogWrite
(
M1
,
val
);
//the speed value of motorA is val
analogWrite
(
M2
,
0
);
analogWrite
(
E2
,
val
);
//the speed value of motorA is val
delay
(
500
);
analogWrite
(
M1
,
0
);
analogWrite
(
E1
,
0
);
//the speed value of motorA is 0
analogWrite
(
M2
,
0
);
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 ...