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?
/*
Blink
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*
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!
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 : http://arduino.cc/en/Tutorial/RowColumnScanning
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.
i.e in the digram is your counter effectively connected to pins 13.3.4.10 etc
Or
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
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)