![Keywish Hummer-Bot-1.0 Скачать руководство пользователя страница 53](http://html.mh-extra.com/html/keywish/hummer-bot-1-0/hummer-bot-1-0_instruction-manual_1962646053.webp)
50
Serial
.
(
dl
);
Serial
.
(
" "
);
Serial
.
(
dr
);
Serial
.
(
" "
);
Serial
.
println
(
"Turning left"
);
/*Through the "Serial Monitor" print the current
status of the car and the value collected by the sensor*/
delay
(
300
);
analogWrite
(
M1
,
0
);
analogWrite
(
E1
,
0
);
analogWrite
(
M2
,
0
);
analogWrite
(
E2
,
0
);
/*As the car left after about 300ms stop, after measuring, 300ms
time car just can rotate about 90 degrees, because the DC motor does not like the steering
angle can be precisely controlled, so can only give a rough estimate, of course, different
motor speed is not Similarly, the time used is not the same, so everyone in the experiment
can be based on their own ideas, but the angle of 90, but also other values.*/
delay
(
1000
);
//************************************//Turning left
}
if
(
dl
<=
38
&&
dr
<=
38
)
{
/*If the value collected by the left sensor is less than or
equal to 38 and the right value is less than or equal to 38, the following program in {} is
executed (dl <= 38, indicating that there is an obstacle on the left and dr<= 38 shows that
there is an obstacle on the right, so at this time the car is rotated 180 degrees backwards.
In the experiment, the car can just turn around 180 degrees after 500ms of rotation. Because
the DC motor can not precisely control the angle like the steering gear, An approximate value,
of course, different motor speed is not the same, the time used is not the same, so everyone
in the experiment can be based on the circumstances may be.)*/
analogWrite
(
M1
,
255
);
//the speed value of motorA is 255
analogWrite
(
E1
,
0
);
analogWrite
(
M2
,
0
);
analogWrite
(
E2
,
255
);
//the speed value of motorB is 255
Serial
.
(
dl
);
Serial
.
(
" "
);
Serial
.
(
dr
);
Serial
.
(
" "
);
Serial
.
println
(
"Turning around"
);
/*Through the "Serial Monitor" print the current
status of the car and the value collected by the sensor.*/
delay
(
500
);
analogWrite
(
M1
,
0
);
analogWrite
(
E1
,
0
);
analogWrite
(
M2
,
0
);
analogWrite
(
E2
,
0
);
/*Rotate 180 degrees and stop*/
delay
(
1000
);
//*********************************//Turning around
}
Содержание Hummer-Bot-1.0
Страница 1: ...Hummer Bot 1 0 Instruction Manual V 2 0 ...
Страница 18: ...15 Step4 You need to install motors Figure 3 1 5 Schematic diagram of motor installation ...
Страница 50: ...47 Figure 3 2 15 Diagram of Data without Obstacles ...
Страница 83: ...80 Test code Path hummer bot Lesson ModuleDemo IrkeyPressed IrkeyPressed ino ...