Hello arduino folks,
This is my first time posting on this forum but i have been reading some posts for a while.
I'm a first year Electrical engineering student. I have a schoolproject where we have to build a clock.
We as a group decided to do this with 74hc595 chips and tons of RGB LEDs.
Now i built a circuit with 16 RGB LEDS and 4 74hc595 (i'm using the red and the blue pins of the RGBS)
I have a question about the code. I basically want the red LED(of the RGB) to switch to the next LED of the sequence every 1 second(second counter)
, while the blue LED stays in place at the first LED of the sequence.
Then after 16 seconds i want the blue LED to jump to the next LED in the sequence ( the minute counter).
Then the RED LED restarts its sequence.
I would really appreciate some help with this because we have been stuck at this point of the project for a while.
If you have any questions regarding our specifications i would be glad to answer them.
Here is how our current code looks like.
(Code tags added by moderator)
int dataPin = 2; //Define which pins will be used for the Shift Register control
int latchPin = 3;
int clockPin = 4;
int dataPin1 = 5;
int latchPin1 = 6;
int clockPin1 = 7;
int seq2[16] = {0,0,0,0,0,0,0,0,1,2,4,8,16,32,64,128}; //The array for storing the
// byte #1 value
int seq1[16] = {1,2,4,8,16,32,64,128,0,0,0,0,0,0,0,0}; //The array for storing the
// byte #2 value
int seq3[16] = {0,0,0,0,0,0,0,0,1,2,4,8,16,32,64,128};
int seq4[16] = {1,2,4,8,16,32,64,128,0,0,0,0,0,0,0,0};
void setup()
{
pinMode(dataPin, OUTPUT); //Configure each IO Pin
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin1, OUTPUT);
pinMode(latchPin1, OUTPUT);
pinMode(clockPin1, OUTPUT);
}
void loop()
{
for (int x = 0; x < 16; x++) //Array Index
{
digitalWrite(latchPin, LOW); //Pull latch LOW to start sending data
shiftOut(dataPin, clockPin, MSBFIRST, seq1[x]); //Send the data byte 1
shiftOut(dataPin, clockPin, MSBFIRST, seq2[x]); //Send the data byte 2
digitalWrite(latchPin, HIGH); //Pull latch HIGH to stop sending data
delay(500);
}
if (int seq2 = 128){
for (int x = 0; x < 16; x++){
digitalWrite(latchPin1, LOW);
shiftOut(dataPin1, clockPin1, MSBFIRST, seq4[x]);
shiftOut(dataPin1, clockPin1, MSBFIRST, seq3[x]);
digitalWrite(latchPin1, HIGH); //Pull latch HIGH to stop sending data
delay(1000);
}
}
}