Copy right © 2018 Shenzhen Emakefun Technology co., Ltd.
36
transmitted and received echo recorded by the timer, the distance S of the emission point from the obstacle
can be calculated, that is:
S = V·
△
t /2
Drive Ultrasonic Module
The PS2X&Motor Driver Board has a four-wire ultrasonic module interface on the driver board. The
four pins are the power supply pin (vcc), the ultrasonic signal transmission pin (A1), the ultrasonic signal
receiving pin (A1), and the ground (GND). The four pins are connected to the corresponding pins of the
ultrasonic module (as shown in Figure 12-1), as shown in Figure 12-2. (Example program file path: Load
file -> ArduinoDemo -> Ultrasonic -> Ultrasonic .ino) After burning the sample program, turn on the power
switch and turn on the serial monitor. You will see the distance of the ultrasonic probe continuously printed
on the serial monitor. The schematic diagram of the ultrasonic obstacle avoidance module interface is shown
in Figure 12-3.