Concept
For this assignment, I used the ultrasonic sensor to make something like a parking sensor. If the distance is above a certain threshold, the LED displays green. If the distance is below the threshold, it gradually turns red along the distance of 20 centimeters. After that, the LED turns completely red. There are two switches used as input for digital data. One is this system’s overall switch, which shuts the entire system when open. Once it’s closed, a blue LED lights up indicating the system is functioning. The other button when pressed, records the current distance the sensor gets and stores this data as the new threshold.
Video Example: