77
Serial
.
(
dl
);
Serial
.
(
" "
);
/ * Ultrasonic acquisition of the left side of the car and
obstacles distance, and then assigned to dl, then print on the "Serial Monitor" * /
head
.
write
(
0
);
/ * Servo steering from the original 180 degrees to 0 degrees, the
right side of the car * /
delay
(
1000
);
analogWrite
(
TrigPin
,
0
);
// Low high and low send a short pulse to TrigPin
delayMicroseconds
(
2
);
analogWrite
(
TrigPin
,
255
);
delayMicroseconds
(
10
);
analogWrite
(
TrigPin
,
0
);
dr
=
pulseIn
(
EchoPin
,
HIGH
)
/
58.0
;
// Convert the echo time to cm
Serial
.
(
"Right distance = "
);
Serial
.
(
dr
);
Serial
.
(
" "
);
Serial
.
println
();
/*Ultrasonic acquisition of the distance between the right side of
the car and the obstacle, and then assigned to dr, and then print the distance on the
"Serial Monitor" * /
head
.
write
(
80
);
// head steering back, that is, when the initialization 80
degrees position
if
(
dl
>=
20
&&
dl
<=
1000
&&
dl
>
dr
)
{
digitalWrite
(
M1
,
0
);
analogWrite
(
E1
,
180
);
//the speed value of motorA is 180
digitalWrite
(
M2
,
180
);
//the speed value of motorB is 180
analogWrite
(
E2
,
0
);
Serial
.
println
(
"Turning left1"
);
delay
(
200
);
// determine the left and right distance if the left is larger
than the left
}
else
if
(
dl
>=
1000
)
{
digitalWrite
(
M1
,
180
);
//the speed value of motorA is 180
analogWrite
(
E1
,
0
);
digitalWrite
(
M2
,
0
);
analogWrite
(
E2
,
180
);
//the speed value of motorB is 180
Serial
.
println
(
"Turning right1"
);
delay
(
200
);
Содержание Hummer-Bot
Страница 1: ...Hummer Bot Instruction Manual Github https github com keywish keywish hummer bot...
Страница 7: ...4...
Страница 8: ...5...
Страница 9: ...6...
Страница 10: ...7...
Страница 13: ...10 Fig 2 2 Several commonly usedArduino...
Страница 15: ...12 After the completion as shown...
Страница 16: ...13 The second step is to Welding wire on the motor...
Страница 17: ...14 After the completion as shown...
Страница 19: ...16 Fig 3 1 3 Diagram of Aluminum Alloy Bracket Installation...
Страница 20: ...17 Fig 3 1 4 Diagram of Motor Installation Fig 3 1 5 Fixing Screw for Motor...
Страница 24: ...21 Fig 3 1 10 Diagram of Wheel Installation Fig 3 1 10 Diagram of Wheel Screw Fixation...
Страница 29: ...26 Fig 3 1 15 Diagram of Tracing Module Installation...
Страница 30: ...27 Fig 3 1 16 Diagram of Screw Brackets Fig 3 1 17 The Back of Complete Installation...
Страница 32: ...29 First install the screws on the UNO After the completion as shown...
Страница 33: ...30 Then install UNO on acrylic plates Fig 3 1 20 Diagram of Arduino Mainboard and Battery Box Installation...
Страница 43: ...40 Fig 3 1 33 Diagram of Wires Arrangement Fig3 1 34 the Effect of Whole Assembly...
Страница 56: ...53 Fig 3 2 11 Diagram of Data with Obstacles Fig 3 2 12 Diagram of Data without Obstacles...
Страница 69: ...66 Fig 3 2 22 Diagram of Steering Gear Fig 3 2 23 Composition of Steering Gear...
Страница 93: ...90 Fig 3 2 42 Receiving Head Position Fig 2 3 43 Installation of Receiving Head...