How to turn on inidivual LED in 8x8 matrix?

I’m running a 8x8 Matrix , via a 4017 Decade counter chip and the arduino board, as well as a resistor bundles. Whenever I use the statement “LedPins[0] , HIGH)” the entire row is always turned on, how would I go about turning on an individual LED on that row?

Turns on an LED on for one second, then off for one second, repeatedly.

This example code is in the public domain.

int LedPins = {2,3,4,5,6,7,8,9};
int Clock1 = 12;
int Clock2 = 13;
void setup() {
for (int i = 0; i < 9; i++) {
pinMode(LedPins*, OUTPUT);*

  • pinMode(Clock1,OUTPUT);*

  • pinMode(Clock2,OUTPUT);*
    *} *
    void loop() {

  • for(int j = 0; j < 9; j++) {*

  • digitalWrite(Clock1,HIGH);*

  • delay(5);*

  • digitalWrite(Clock2,LOW);*

  • delay(5);*

  • digitalWrite(LedPins[0], HIGH); *

  • digitalWrite(LedPins[2], HIGH); // set the LED on*

  • delay(200); // wait for a second*

  • //digitalWrite(LedPins[j], LOW); // set the LED off*

  • //delay(200); // wait for a second*

  • digitalWrite(Clock2,HIGH);*

  • delay(5);*

  • digitalWrite(Clock1,LOW);*

  • delay(5);*

  • }*

Matrix displays need to be multiplexed. They often operate via optical illusion, as in reality the individual LEDS are only on for a split second.

Normally what you do is turn each line of the matrix on, one by one (ie individually) and for each line you set the pattern that is required.

So you code has to constantly run, updating the matrix all the time. You cannot use delays. If your code need to do anything except run the matrix, I suspect you'll need to do something fancy using timer interrups and each time you get an interrupt e.g. ever few milliseconds, you update a row.

However I'm sure this must have been done before, so I'd take a look around for code that drives matrix displays and modify it as necessary.

PS. If you need more help, you may need to post your circuit diagram or at least a block diagram

And BTW. The other minor concern I have is that you don't seem to be restting the counter at the start of your code, I suspect there is chance you could get out of sync at startup if the counter received pulses while you were uploading your code etc

Hey Roger, first of all thanks for the reply, you have no idea how much I've been boggled by such topic! Nonetheless, could you at all expand on what you mean by :"and for each line you set the pattern that is required.". I understand turning on each line, using the commands i used, but how does one go about setting a pattern? Thanks again!

Can you tell me which pins control your rows (or columns) ?

i.e I presume that you use the decade counter as wither row of column select

Assuming that your counter drives the column select likes to the matrix, then you will have multiple Data lines attached to each led in all rows

Do you have a circuit diagram for your connections ?

This is the main issue I'm confused about, I understand my LED has 16 Pins, but how am I so posed to know how to connect each row/column to the arduino. The diagram I have is similar to this one : Except, again I'm extremely confused on my situation as they state "To control an individual LED, you set its column high and its row low." How does one do that? Their code isn't very guide full either.

Is you counter connected to the Row or Column

i.e in the digram is your counter effectively connected to pins etc


is it connected to pins 9,14,8,12

BTW. The RowColumnScaning page you linked to assumes that both the rows and columns are controlled by the Arduino (directly) in your case the 4017 is controlling either row or column addressing

My Decade Counter is connected to 9,14,8,10 (Colum) but it also has connections connected to 6,11,15,16

The thing is, my resistor bunch (8 resistors in 1 chip) only goes to 8 outputs on the arduino, which is once again were my confusion stems. 8 outputs, but 16 (Rows + colums)

8 wires go from the Arduino to control either the Row or Column data

The clock wire (single wire) goes from the Arduino to the clock input on the 4017

8 wires go from the 4017 to either the Columns or Rows of the 8x8 matrix

BTW. I've no idea why you have 2 clock pins defined in your code.

Also, this is not a programming question, at the moment you don't appear to have wired things correctly,

Perhaps you should post to the General Electronics section and ask how to wire it up first.