I want a certain thing to happen but only when the LED is HIGH. How do I do this with an if case? Because I can't get it to work in my main code.
int LED = 3;
int LED2 = 4;
void setup(){
pinMode(LED, OUTPUT);
pinMode(LED2, OUTPUT);
}
void loop(){
digitalWrite(LED, HIGH);
if(LED, HIGH){
digitalWrite(LED2, HIGH);
}
else{
delay(5000);
digitalWrite(LED, LOW);
}
}
@rico459
your above code doesn't make any sense.
you turn LED on, and you test it if it is ON, which will always be true. (the else statement will never execute).