Notifications
Clear all
Topic starter
2020-06-12 4:10 am
2020-06-12 7:32 am
Keep a record of switch state using a variable.
... int flag = 1; 'set flag to 1 ... if (ReceivedMessage[0] == 111) // Indicates switch is pressed { if (flag == 1) { digitalWrite(LED_PIN, HIGH); } else { digitalWrite(LED_PIN, LOW); } flag = -flag; // invert flag } delay(2); } }