Basic Program to display a binary digit with 4 leds. Cannot for the life of me get it to compile. Please help?
#define redLed 8
#define greenLed 9
#define blueLed 10
#define whiteLed 11
#define buttonPress
#define button 12
#define count
void setup() {
// put your setup code here, to run once:
pinMode (redLed, OUTPUT);
pinMode (greenLed, OUTPUT);
pinMode (blueLed, OUTPUT);
pinMode (whiteLed, OUTPUT);
pinMode (button, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
buttonPress = digitalRead(button);
/* Binary Table
- 1 = 1000
- 2 = 0100
- 3 = 1100
- 4 = 0010
- 5 = 1010
- 6 = 0110
- 7 = 1110
- 8 = 0001
- 9 = 1001
- 10 = 0101
- Green = 1000
- Red = 0100
- Blue = 0010
- White = 0001
*/
if(buttonPress == HIGH){
++count;
}
if(count == 1){
digitalWrite(greenLed, HIGH);
}
else if(count==2){ //Binary 0100
digitalWrite(redLed, HIGH);
}
else if(count==3){
digitalWrite(greenLed, HIGH);
digitalWrite(redLed, HIGH);
}
else if(count==4){
digitalWrite(blueLed, HIGH);
}
else if(count==5){
digitalWrite(greenLed, HIGH);
digitalWrite(blueLed, HIGH);
}
else if(count==6){
digitalWrite(redLed, HIGH);
digitalWrite(blueLed,HIGH);
}
else if(count==7){
digitalWrite(greenLed, HIGH);
digitalWrite(redLed, HIGH);
digitalWrite(blueLed, HIGH);
}
else if(count==8){
digitalWrite(whiteLed, HIGH);
}
else if(count==9){
digitalWrite(greenLed, HIGH);
digitalWrite(whiteLed, HIGH);
}
else if(count==10){
digitalWrite(redLed, HIGH);
digitalWrite(whiteLed, HIGH);
}
}