Hi. I'm confused so you can probably help me. I made a 32x8 LED board and started working with it.
//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
//Pin connected to DS of 74HC595
int dataPin = 11;
int blok[8][40];
int counter=0;
int Aca[8][40] ={
{1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,1,1,1,1,1,0,0,0,0,1,1,1,1,1,0,0,0,0,0},
{0,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,0,0,0},
{0,0,1,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,1,1,0,0,0,0},
{0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,1,1,0,0,0,0},
{0,0,0,0,1,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0},
{0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,1,1,0,0,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0},
{0,0,0,0,0,0,1,0,0,0,0,1,1,0,0,0,1,1,0,0,1,1,1,1,1,1,1,0,0,1,1,0,0,0,1,1,0,0,0,0},
{0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1,1,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,0}
};
int Je[8][40] ={
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0},
{0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0},
{0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1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1,0,0,0,0},
{0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,0,0,0,1,1,0,0,0,1,1,0,0,1,1,0,0,0,1,1,0,0,0,0}
};
void loop(){
{
//count up routine
if (counter>=0 && counter <80)
{
Print ( Aca );
}
if (counter>=80 && counter < 160)
{
Print ( Je );
}
/* if (counter>=160 && counter < 240)
{
Print ( Car );
} */
if (counter >= 240) counter=0;
counter++;
}
}
void Print ( int blok[8][40]){
for (int i = 0; i < 8; i++) {
digitalWrite(latchPin, 0);
for (int j = 0; j< 40; j++){
shiftOut(dataPin, clockPin, blok[i][j]);
}
digitalWrite(latchPin, 1);
}
}
void shiftOut(int myDataPin, int myClockPin, byte myDataOut) {
// This shifts 8 bits out MSB first,
//on the rising edge of the clock,
//clock idles low
//internal function setup
int i=0;
int pinState;
pinMode(myClockPin, OUTPUT);
pinMode(myDataPin, OUTPUT);
//clear everything out just in case to
//prepare shift register for bit shifting
digitalWrite(myDataPin, 0);
digitalWrite(myClockPin, 0);
//for each bit in the byte myDataOut?
//NOTICE THAT WE ARE COUNTING DOWN in our for loop
//This means that %00000001 or "1" will go through such
//that it will be pin Q0 that lights.
pinState = myDataOut;
//Sets the pin to HIGH or LOW depending on pinState
digitalWrite(myDataPin, pinState);
//register shifts bits on upstroke of clock pin
digitalWrite(myClockPin, 1);
//zero the data pin after shift to prevent bleed through
digitalWrite(myDataPin, 0);
//stop shifting
digitalWrite(myClockPin, 0);
}
Problem is when I want to print 2 matrices, one after another, it all works fine and I get " Aca Je" on my LED board.
void loop(){
{
//count up routine
if (counter>=0 && counter <80)
{
Print ( Aca );
}
if (counter>=80 && counter < 160)
{
Print ( Je );
}
if (counter >= 160) counter=0;
counter++;
}
}
But when I want to print the 3. one nothing happens, not even a start. Can someone help?
void loop(){
{
//count up routine
if (counter>=0 && counter <80)
{
Print ( Aca );
}
if (counter>=80 && counter < 160)
{
Print ( Je );
}
if (counter>=160 && counter < 240)
{
Print ( Car );
}
if (counter >= 240) counter=0;
counter++;
}
}