SunFounder 3in1 Kit
(continued from previous page)
analogWrite(A_1A, 0);
analogWrite(B_1B, 0);
analogWrite(B_1A, speed);
}
• &&: Logical AND results in true only if both operands are true.
• !: Logical NOT results in a true if the operand is false and vice versa.
5.7 6. Play with Ultrasonic Module
In 5. Play with Obstacle Avoidance Module project, the 2 infrared obstacle avoidance modules are used for obstacle
avoidance, but the detection distance of IR obstacle avoidance module is short, which may make the car too late to
avoid the obstacles.
In this project, we use ultrasonic module to do some long-distance detection, so that the car can sense obstacles at a
farther distance to make a judgment.
Required Components
In this project, we need the following components.
It’s definitely convenient to buy a whole kit, here’s the link:
Name ITEMS IN THIS KIT LINK
3 in 1 Starter Kit 380+
You can also buy them separately from the links below.
COMPONENT INTRODUCTION PURCHASE LINK
Arduino Uno R4 Minima
L9110 Motor Driver Module -
TT Motor -
Ultrasonic Module
Wiring
An ultrasonic sensor module is an instrument that measures the distance to an object using ultrasonic sound waves. It
has two probes. One is to send ultrasonic waves and the other is to receive the waves and transform the time of sending
and receiving into a distance, thus detecting the distance between the device and an obstacle.
Now build the circuit according to the following diagram.
Ultrasonic Module R4 Board
Vcc 5V
Trig 3
Echo 4
Gnd GND
248 Chapter 5. Car Projects