Hi all,
I've built three seven segment displays each driven by a 74hc164 shift register. I've tested each pair separately with this code:
#define data 2
#define clock 3
byte zero = B01111110;
byte one = B00000110;
byte two = B11011010;
byte three = B11010110;
byte four = B10100110;
byte five = B11110100;
byte six = B11111100;
byte seven = B01000110;
byte eight = B11111110;
byte nine = B11110110;
void setup()
{
pinMode(clock, OUTPUT); // make the clock pin an output
pinMode(data , OUTPUT); // make the data pin an output3
}
void loop()
{
shiftOut(data, clock, LSBFIRST, zero);
delay(500);
shiftOut(data, clock, LSBFIRST, one);
delay(500);
shiftOut(data, clock, LSBFIRST, two);
delay(500);
shiftOut(data, clock, LSBFIRST, three);
delay(500);
shiftOut(data, clock, LSBFIRST, four);
delay(500);
shiftOut(data, clock, LSBFIRST, five);
delay(500);
shiftOut(data, clock, LSBFIRST, six);
delay(500);
shiftOut(data, clock, LSBFIRST, seven);
delay(500);
shiftOut(data, clock, LSBFIRST, eight);
delay(500);
shiftOut(data, clock, LSBFIRST, nine);
delay(500);
}
And they work perfectly.
Now I've written this code to condense all that and eventually operate the three pairs together.
When I try to compile the code it gives me the error "expected unqualified ID before '[' token.
#define data 2;
#define clock 3;
void setup() {
int mE=-1;
// use binary notation to discribe our number layout
byte [0] = B00000001;
byte [1] = B11000111;
byte [2] = B00100010;
byte [3] = B10000010;
byte [4] = B11000100;
byte [5] = B10001000;
byte [6] = B00001000;
byte [7] = B11000011;
byte [8] = B00000000;
byte [9] = B10000000;
pinMode(clock, OUTPUT); // make the clock pin an output
pinMode(data , OUTPUT); // make the data pin an output3
}
void loop(){
for(int mE = -1; mE<11; mE++) {
shiftOut(data, clock, LSBFIRST, mE);
delay(500);
if(mE == 10){
int(mE) = -1;
}
}
}
So to summarise I'm asking for improvements upon my code. Any help is appreciated thank you.
BTW I'm new to C so please excuse the code. :~