<< Read Previous Page
There is no direct method to turn on 1st LED and 10th LED at a time. To turn on the 1st LED, positive voltage should be given to the 16th pin and negative voltage should be given to the 4th pin of LED matrix. To turn on 10th LED, positive voltage should be given to the 15th pin and negative voltage should be given to the 7th pin of LED matrix. Beginners will assume that, 1st LED and 10th LED will turn on together if positive voltage is given to 15th pin and 16th pin of LED matrix and negative voltage is given to the 4th pin and 7th pin of LED matrix. Result will not be expected one. 1st, 2nd, 9th and 10th LEDS will turn on. Because, these four LEDs get both positive and negative voltages. But we want to turn on 1st and 10th LEDs only. This situation is pictorially explained below.
In such situations, a new method is used. This method works based on the theory of "persistence of vision" which means an object seen by our eyes will remain in our eyes for 1/16th portion of a second.
Algorithm to implement this method in LED matrix
1. Turn on 1st LED and turn off all the other LEDs.
2. Turn off all the LEDs.
3. Turn on 10th LED and turn off all the other LEDs.
4. Turn off all the LEDs.
Continuing this process forever will give the expected output. This algorithm can be easily implemented using Arduino mega and 8*8 LED matrix. Circuit is done as given below.
Now upload the following program to your arduino board.
If uploading is successful, LED matrix will give the expected output. If the output is obtained successfully, most of the beginners will think that all the 64 LEDs can be easily controlled if the remaining output pins of LED matrix is connected to the other digital pins of arduino. But it is not a good idea, because if all the 64 LEDs were on at a time, large current will be drawn from arduino. Microcontroller get heated up which may result in permanent damage of your arduino board. Read about the technique to increase the brightness of these LEDs in next page.
Steps to Turn on 1st and 10th LEDs at a Time
There is no direct method to turn on 1st LED and 10th LED at a time. To turn on the 1st LED, positive voltage should be given to the 16th pin and negative voltage should be given to the 4th pin of LED matrix. To turn on 10th LED, positive voltage should be given to the 15th pin and negative voltage should be given to the 7th pin of LED matrix. Beginners will assume that, 1st LED and 10th LED will turn on together if positive voltage is given to 15th pin and 16th pin of LED matrix and negative voltage is given to the 4th pin and 7th pin of LED matrix. Result will not be expected one. 1st, 2nd, 9th and 10th LEDS will turn on. Because, these four LEDs get both positive and negative voltages. But we want to turn on 1st and 10th LEDs only. This situation is pictorially explained below.
In such situations, a new method is used. This method works based on the theory of "persistence of vision" which means an object seen by our eyes will remain in our eyes for 1/16th portion of a second.
Algorithm to implement this method in LED matrix
1. Turn on 1st LED and turn off all the other LEDs.
2. Turn off all the LEDs.
3. Turn on 10th LED and turn off all the other LEDs.
4. Turn off all the LEDs.
Continuing this process forever will give the expected output. This algorithm can be easily implemented using Arduino mega and 8*8 LED matrix. Circuit is done as given below.
int pin_4 = 10; //Connect 4th pin of LED matrix to the 10th pin of arduino int pin_7 = 11; //Connect 7th pin of LED matrix to the 11th pin of arduino int pin_15 = 13; //Connect 15th pin of LED matrix to the 13th pin of arduino int pin_16 = 12; //Connect 16th pin of LED matrix to the 12th pin of arduino // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(pin_4, OUTPUT); pinMode(pin_7, OUTPUT); pinMode(pin_15, OUTPUT); pinMode(pin_16, OUTPUT); } // the loop routine runs over and over again forever: void loop() { // Turn on 1st LED and turn off all the other LEDs digitalWrite(pin_4, LOW); digitalWrite(pin_16, HIGH); // Turn off 1st LED digitalWrite(pin_4, HIGH); digitalWrite(pin_16, LOW); // Turn on 10th LED and turn off all the other LEDs digitalWrite(pin_7, LOW); digitalWrite(pin_15, HIGH); // Turn off 10th LED digitalWrite(pin_7, HIGH); digitalWrite(pin_15, LOW); }
If uploading is successful, LED matrix will give the expected output. If the output is obtained successfully, most of the beginners will think that all the 64 LEDs can be easily controlled if the remaining output pins of LED matrix is connected to the other digital pins of arduino. But it is not a good idea, because if all the 64 LEDs were on at a time, large current will be drawn from arduino. Microcontroller get heated up which may result in permanent damage of your arduino board. Read about the technique to increase the brightness of these LEDs in next page.
Read Next Page >> |
0 comments: