Hello,
I am trying to write code so that the timing of my LED sequence changes when I change the voltage level on input A.
Can you help me get past the compiler error please?
expected '(' before numeric constant
int red = 13;
int yellow = 12;
int green = 11;
int blue = 10;
int A = 9;
int B = 8;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(red, OUTPUT);
pinMode(yellow, OUTPUT);
pinMode(green, OUTPUT);
pinMode(blue, OUTPUT);
pinMode(A, INPUT);
}
// the loop routine runs over and over again forever:
void loop(){
digitalWrite(red, HIGH); // turn the LED on (HIGH is the voltage level)
delay(900); // wait for a second
digitalWrite(red, LOW); // turn the LED off by making the voltage LOW
delay(200);
digitalWrite(red, HIGH); // turn the LED on (HIGH is the voltage level)
delay(900); // wait for a second
digitalWrite(red, LOW); // turn the LED off by making the voltage LOW
delay(100);
{digitalWrite(yellow, HIGH);
delay(900);
digitalWrite(yellow, LOW);
delay(200);}
{digitalWrite(yellow, HIGH);
delay(900);
digitalWrite(yellow, LOW);
delay(200);}
{digitalWrite(green, HIGH);
delay(900);
digitalWrite(green, LOW);
delay(200);}
{digitalWrite(green, HIGH);
delay(900);
digitalWrite(green, LOW);
delay(200);}
{digitalWrite(blue, HIGH);
delay(900);
digitalWrite(blue, LOW);
delay(200);}
{digitalWrite(blue, HIGH);
delay(900);
digitalWrite(blue, LOW);
delay(200);}
if INPUT A = HIGH;
digitalWrite(red, HIGH); // turn the LED on (HIGH is the voltage level)
delay(200); // wait for a second
digitalWrite(red, LOW); // turn the LED off by making the voltage LOW
delay(200);
digitalWrite(red, HIGH); // turn the LED on (HIGH is the voltage level)
delay(200); // wait for a second
digitalWrite(red, LOW); // turn the LED off by making the voltage LOW
delay(200);
{digitalWrite(yellow, HIGH);
delay(200);
digitalWrite(yellow, LOW);
delay(200);}
{digitalWrite(yellow, HIGH);
delay(200);
digitalWrite(yellow, LOW);
delay(200);}
{digitalWrite(green, HIGH);
delay(200);
digitalWrite(green, LOW);
delay(200);}
{digitalWrite(green, HIGH);
delay(200);
digitalWrite(green, LOW);
delay(200);}
{digitalWrite(blue, HIGH);
delay(200);
digitalWrite(blue, LOW);
delay(200);}
{digitalWrite(blue, HIGH);
delay(200);
digitalWrite(blue, LOW);
delay(200);}}