Assignment 6
Output and Input devices
Output Devices
An RGB led and buzzer are connected to a microcontroller and are programmed to work in sync, that is the light on the RGB led corresponds to the note played on the buzzer. The setup of the circuit is shown in the image below.
The code for the set up can be found below.
CodeBelow is a video of the circuit in action.
Input and Output Devices
As mentioned in Assignment 5 the ultrasonic sensor can be used as a parking assistant. If we attach a buzzer to the existing circuit and program to beep within a certain distance range then the driver will be alerted.
The buzzer negative was connected to ground and the positive to the pin 2.
The following code was used.
The video below shows the working of the set up. As the book crosses the 18cm mark, as seen on the scale placed near the circuit, the buzzer beeps.
The serial monitor also displays the distance for each second. The graph below shows the data of the distance at various times during the experiment.