I'm trying to do a if, then, else statement that checks if a pin is high, but hell, I don't know, seems simple but it just doesn't work
The unincluded code right now is simplified to just turn on Green, delay, turn off Green turn on yellow, delay, turn off yellow turn on green
if (Green == HIGH)
digitalWrite(Red2, HIGH);
else if (Yellow == HIGH)
digitalWrite(Red2, HIGH);
else digitalWrite(Red2, LOW);
Here's what my first attempt was, this compiled, but Red2 never lit.. shrug
if (digitalRead(Green, HIGH) == true)
digitalWrite(Red2, HIGH);
else if (digitalRead(Yellow, HIGH) == true)
digitalWrite(Red2, HIGH);
else digitalWrite(Red2, LOW);
I thought of this about 15 minutes ago, but it doesn't compile
if (digitalRead(Green) == HIGH)
digitalWrite(Red2, HIGH);
else if (digitalRead(Yellow) == HIGH)
digitalWrite(Red2, HIGH);
else digitalWrite(Red2, LOW);
As I was typing this I tried this one. And, it compiles, but... nothing
I'm probably missing something obvious, haven't played with Arduino in a couple weeks...