Firstly, can I say this is my 1st post on here and i'm relatively new to the arduino and with limited programming skills but so far enjoying the frustrations of learning, so please bear with me.
I purchased a couple of these 4-bit LED digital tube modules and with the help of searching this forum I have managed to get a single module working and displaying whatever my 4 variables holds.
What i'm now trying to achieve is to daisy chain two of these modules so I can display 8 single digit variables.
I have soldered the two together, as per image using gnd-gnd dio-qh rclk-rclk sclk-sclk vcc-vcc.
With the code I have, I can choose which module to display on by setting the digit var to 0 or 4, but it is just mirrored to the other module. How can I changed the code so it will display all 8 variables 0-8?
Many thanks in advance.
const int clock = 7; //SCK
const int latch = 5; //RCK
const int data = 6; //DIO
unsigned char LED_0F[] =
{// 0 1 2 3 4 5 6 7 8 9 A b C d E F -
0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, 0x80, 0x90, 0x88, 0x83, 0xC6, 0xA1, 0x86, 0x8E, 0xbf, 0x7F, 0xFF
};
unsigned char LED[8];
int SCLK = 7;
int RCLK = 5;
int DIO = 6;
void setup ()
{
Serial.begin(9600);
pinMode(SCLK,OUTPUT);
pinMode(RCLK,OUTPUT);
pinMode(DIO,OUTPUT);
}
void loop()
{
LED[7] = 1;
LED[6] = 2;
LED[5] = 3;
LED[4] = 4;
LED[3] = 5;
LED[2] = 6;
LED[1] = 7;
LED[0] = 8;
LED4_Display ();
}
void LED4_Display (void)
{
byte digit = 4;
for (byte dselect = 1; dselect < 0x10; dselect = dselect << 1)
{
LED_OUT(LED_0F[LED[digit]]);
LED_OUT(dselect);
digitalWrite(RCLK, LOW);
digitalWrite(RCLK, HIGH);
++digit;
}
}
void LED_OUT(unsigned char X)
{
unsigned char i;
for(i=8;i>=1;i--)
{
if (X&0x80)
{
digitalWrite(DIO,HIGH);
}
else
{
digitalWrite(DIO,LOW);
}
X<<=1;
digitalWrite(SCLK,LOW);
digitalWrite(SCLK,HIGH);
}
}