== Materials Needed\\ a. For this project, you will need to use TinkerCAD since your Arduino kits do not have motors available.\\ b. You will need a motor, an Arduino, a dark blue ultrasonic sensor with 4 pins, and a breadboard.\\ == Steps\\ [[Image(Ultrasonic Sensor Circuit.jpg​, 25%)]] a. Let's start by putting down a breadboard to hold the other components together.\\ b. Then, take out an ultrasonic sensor (the dark blue one with 4 pins on the bottom) and place it so that the 4 pins touch 4 of the middle columns of holes as seen in the picture.\\ c. Next, take out a motor, and connect the black pin to the row of holes next to the black line.\\ d. Then, connect the row of holes next to the black line to the GND of the Arduino, and connect the rows of holes next to the red line to the 5v of the Arduino.\\ e. Connect the red pin of the motor to digital pin 4.\\ f. After that, connect the column of holes connected to the Vcc pin of the ultrasonic sensor to the row of holes next to the red line.\\ g. Then, connect the column of holes connected to the GND of the ultrasonic sensor to the row of holes next to the black line.\\ h. Next, connect the column of holes connected to the TRIG pin of the ultrasonic sensor to digital pin 3.\\ i. Then, connect the column of holes connected to the ECHO pin of the ultrasonic sensor to digital pin 2.\\ j. Finally, copy and paste the code below into the TinkerCAD code area with the code option set to text instead of blocks.\\ k. Play the simulation, press the ultrasonic sensor, and move the circle around and see what happens (particularly with the amount of distance and how that makes the motor spin or turn off).\\ Code:\\ const int TRIG = 3;\\ const int ECHO = 2;\\ const int MOTOR = 4;\\ float distance, time;\\ void setup()\\ {\\ pinMode(TRIG, OUTPUT);\\ pinMode(ECHO, INPUT);\\ pinMode(MOTOR, OUTPUT);\\ Serial.begin(9600);\\ }\\ void loop()\\ {\\ digitalWrite(TRIG, LOW);\\ delayMicroseconds(2);\\ digitalWrite(TRIG, HIGH);\\ delayMicroseconds(10);\\ digitalWrite(TRIG, LOW);\\ time = pulseIn(ECHO, HIGH);\\ distance = (0.0343*time/2);\\ Serial.println(distance);\\ if (distance <= 100){\\ digitalWrite(MOTOR, LOW);\\ }\\ else if (distance > 100){\\ digitalWrite(MOTOR, HIGH);\\ }\\ }\\ == Explanation of how it works\\ a. This project will help you understand how the ultrasonic sensor works, which you will be using in your projects during the meetings.\\ b. The ultrasonic sensor sends out an ultrasonic wave whenever the digital pin that connects to the TRIG pin provides a voltage (electronic signal) which happens due to the code.\\ c. When the ultrasonic wave reflects off an object and hits the receiver of the ultrasonic sensor, the ultrasonic sensor sends a signal to the Arduino’s digital pin that the ECHO pin is connected to.\\ d. The Arduino takes the time it took for the ultrasonic wave to be sent out, and received, and divides that in half (to get the amount of time to the object, but not the return trip).\\ e. The Arduino can then use this time and multiplies it by the speed of sound in centimeters per microsecond to get the distance.\\ f. The Arduino will turn on the motor if the distance is greater than 100 centimeters, and will turn the motor off if it is less or equal to than 100 centimeters.