when compiling, it is not happy with the "break" portion..There is something with the "switch" that isn't jibing..
I tried to troubleshoot but now I'm a bit confused..
Can someone take a look? I know this is simple, but I am trying to learn!
Code:
int LED = 13;
int Button = 12;
int programState = 0;
void setup()
{
pinMode(LED,OUTPUT);
pinMode(Button,INPUT);
digitalWrite(Button,HIGH); //enable pull-up
}
void loop(){
if (digitalRead (Button)==0){ // assumes button declared as INPUT with internal pullup enabled
programState = programState +1;}
if (programState ==3){ // reset after 5, or whatever amount you select
programState = 1;
delay (25); // may not need if the programs run long enough for the button to debounce
}
switch(programState)
case 1:
digitalWrite(LED,HIGH);// basic blink
delay (500);
digitalWrite(LED,LOW);
delay (500);
break;
case 2:
digitalWrite(LED,HIGH);//quicker blink
delay (100);
digitalWrite(LED,LOW);
delay (100);
break;
case 3:
digitalWrite(LED,LOW); //off
}
int Button = 12;
int programState = 0;
void setup()
{
pinMode(LED,OUTPUT);
pinMode(Button,INPUT);
digitalWrite(Button,HIGH); //enable pull-up
}
void loop(){
if (digitalRead (Button)==0){ // assumes button declared as INPUT with internal pullup enabled
programState = programState +1;}
if (programState ==3){ // reset after 5, or whatever amount you select
programState = 1;
delay (25); // may not need if the programs run long enough for the button to debounce
}
switch(programState)
case 1:
digitalWrite(LED,HIGH);// basic blink
delay (500);
digitalWrite(LED,LOW);
delay (500);
break;
case 2:
digitalWrite(LED,HIGH);//quicker blink
delay (100);
digitalWrite(LED,LOW);
delay (100);
break;
case 3:
digitalWrite(LED,LOW); //off
}