hypertroxics:
const int tDelay = 15;
const int tDelayUs = 625; // 64 * 15,625 msec = 1 sec
const int dataPin1 = 12;
const int latchPin1 = 11;
const int clockPin1 = 10;
const int dataPin2 = 8;
const int latchPin2 = 7;
const int clockPin2 = 6;
void setup()
{
pinMode(latchPin1, OUTPUT);
pinMode(dataPin1, OUTPUT);
pinMode(clockPin1, OUTPUT);
pinMode(latchPin2, OUTPUT);
pinMode(dataPin2, OUTPUT);
pinMode(clockPin2, OUTPUT);
}
unsigned long int leds1=0;
unsigned long int leds2=0;
void updateShiftRegister1()
{
unsigned int leds16 = int(leds1);
unsigned int leds32 = int(leds1>>16);
byte A = lowByte(leds16);
byte B = highByte(leds16);
byte C = lowByte(leds32);
byte D = highByte(leds32);
digitalWrite(latchPin1, LOW);
shiftOut(dataPin1, clockPin1, LSBFIRST, A);
shiftOut(dataPin1, clockPin1, LSBFIRST, B);
shiftOut(dataPin1, clockPin1, LSBFIRST, C);
shiftOut(dataPin1, clockPin1, LSBFIRST, D);
digitalWrite(latchPin1, HIGH);
}
void updateShiftRegister2()
{
unsigned int leds48 = int(leds2);
unsigned int leds64 = int(leds2>>16);
byte E = lowByte(leds48);
byte F = highByte(leds48);
byte G = lowByte(leds64);
byte H = highByte(leds64);
digitalWrite(latchPin2, LOW);
shiftOut(dataPin2, clockPin2, LSBFIRST, E);
shiftOut(dataPin2, clockPin2, LSBFIRST, F);
shiftOut(dataPin2, clockPin2, LSBFIRST, G);
shiftOut(dataPin2, clockPin2, LSBFIRST, H);
digitalWrite(latchPin2, HIGH);
}
void loop()
{
int k;
for (int i=0;i<8;i++ )
{
for(int j=0; j<8; j++)
{
updateShiftRegister1();
updateShiftRegister2();
leds1 = pow(2,32)-1;
leds2 = pow(2,32)-1;
if (k%32 ==0)
{
{
leds1 = pow(2,32)-1;
leds2 = pow(2,32)-1;
bitClear (leds1, k);
updateShiftRegister1();
updateShiftRegister2();
k++;
}
}
else (k%32 !=0);
{
{
int m = k-32;
leds1 = pow(2,32)-1;
leds2 = pow(2,32)-1;
bitClear (leds2,m);
updateShiftRegister1();
updateShiftRegister2();
k++;
}
}
delay (tDelay);
delayMicroseconds (tDelayUs);
}
}
}
or, in this way if I do 32 bits separately, do you think it works?