I need to set all LEDs to LOW except the one I want to be on HIGH. Currently, I have to send a specific request to all LEDs to ensure that the previous LED will be set on LOW. If i apply this logic to a lot of LEDs the code will be quite long.
Is there a way to say
Question
- set led on high but all others on low?
This code will switch on led.
if (readString.indexOf("?wall01_02") > 0) {
digitalWrite(led, HIGH);
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
the next time I'm going to send a request to led1, but I also have to switch off the previous LED led.
if (readString.indexOf("?wall01_01") > 0) {
digitalWrite(led, LOW);
digitalWrite(led1, HIGH);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);