b'Circuit 3B:Distance sensors are amazing tools with all kinds of uses. They can sense the Distance presence of an object, they can be used Sensorin experiments to calculate speed and 330 100k 10kacceleration, and they can be used in robotics to avoid obstacles. This circuit will walk you through the basics of using an ultrasonic distance sensor, which measures distance using sound waves!YOURGB LED3 330RESISTORSDISTANCE SENSOR10 JUMPER WIRESHC-SR04NEED T RVCC Trig Echo GNDNEW COMPONENTS the datasheet for the distance sensor. In it, you can find the equation the program ULTRASONIC DISTANCE SENSOR:needs to interpret the distance. View the Distance sensors work by sending pulses ofdatasheet at http://sfe.io/HCSR04.light or sound out from a transmitter, then timing how long it takes for the signals toELSE IF STATEMENTS: In the night-bounce off an object and return to a receiverlight circuit, you used an if/else statement (just like sonar). Some sensors use infraredto run one set of code when a logic light, some use lasers, and some, like thestatement was true, and another when HC-SR04 included in your kit, use ultrasonicit was false. What if you wanted to have sound (sound so high-pitched that you cantmore than two options? Else if statements hear it). let you run as many logical tests as you want in one statement. For example, in the code for this circuit, there is an if statement HC-SR04 that flows like this:1.If the distance is less than 10, make T VCC Trig Echo GND R the RGB LED red.2.Else if the distance is more than 10 but less than 20, make the RGB LED NEW CONCEPTS yellow.DATASHEETS: When working with3.Else make the RGB LED green.electronics, datasheets are your best friend. Datasheets contain all the relevantTo have four or five colors for different information needed for a part. In thisdistances, add more else if statements.circuit, we are calculating distance basedElse if statements are different from on the time it takes sound waves to benested if statements in that only one of transmitted, bounce off an object and thenthe statements above can be true, whereas be received. But, how can we tell distancemultiple nested if statements could be true.from that information? The answer lies in 60 : circuit 3b'