Handling multiple states is one of the keystones of programming. In this example we use one button to cycle through 3 LEDs. This gives us a 4 states (all off, red,green,yellow). By passing the state between variables we can cycles through them with ease. This example uses the button debouncing code that was described in this video:
-~-~~-~~~-~~-~-
Please watch: “ESP8266 and Arduino–How much power do they need”
-~-~~-~~~-~~-~-
Post time: Jun-15-2017