Assignment 3
Working with a 3*3 LED Matrix to write the letters of my name
Objective:
To write my name by switching 9 LEDs on/off and push buttons such that:
1) With press of one push button, the letters of the name blink every 1000 ms
2) With press of another push button, all LEDs blink ON and then OFF with a delay of 1000 ms.
3) Also, print the letter typed on the Serial Monitor
Components Needed:
- Arduino UNO board
- 9 LED s
- Jumper Wires
- 9 resistors
- 2 push buttons
- Breadboard
Circuit Diagram:
Arduino Code:
- For Printing name And then turning all the LEDs ON and OFF
- For Displaying letter on the LEDs using serial monitor.
The link for the code can be found HERE
Connection and Logic Behind the code
So we used 9 LEDs to represent the letters of our name by turning ON and OFF the required LEDs as per the letter. Also we used 2 push buttons. We named them Button A and Button B. Button A was connected to I/O pin 10and Button B to pin 11, and the other terminals to ground. The 9 LEDs were connected from PIN 1 to PIN 9.
In the code at first we named the LEDs as LedPin1,LedPin2 and soon till LedPin9 and set the pins as OUTPUT. Also we declared Push Buttons Aand B as Input Pullups.
Then we declared various functions namely S(),I(),D(),H(),A(),R(),T(),H(), representing various letters of my name. These functions would turn the lEDs ON and OFF according to the letter that we want to represent.
Then in the loop function we write the code such as that when button A is pressed pin 10 goes to low and the functions representing my name are executed at an interval of 1000 ms.
And if Button B is pressed all the LEDs turn ON and OFF for 5 times with an interval of 1000 ms.
Final output
The images and videos of the final output can be found below
Video for the first part of the assignment for displaying name using 9 LEDs and a push button
Video for the second part of the assignment for turning all the LEDs ON and OFF 5 times
Video for printing letter typed in serial monitor