Testing the sensors
In this section, we will test the ultrasonic sensor and the line-following sensor that come with the robotics kit. We will start by testing the ultrasonic sensor.
Ultrasonic sensor
Ultrasonic sensors are generally used in obstacle-avoidance applications. They use the time of flight principle to measure the distance between objects. The sensor transmits a sound signal at a known frequency in the ultrasonic spectrum. The sound signal bounces off the surface of obstacles back to the sensor. The time elapsed since the transmission of the signal is used to calculate the distance between the sensor and the object. The distance between objects is calculated as follows:
Speed = Distance / Time
Distance = (Speed of Sound x Time) / 2
We divide by two because the sound has to travel twice between the obstacle and the sensor.
You can learn about ultrasonic sensors at https://bit.ly/3xeqpS2.
The ultrasonic sensor can be installed on both the front and...