While working on my clock designs I have been looking at backup plans for my Arduino that I could base my work off of. Below is a design for a simple traffic light system.
I could possibly add a bit more interactability to this project, but it was a good way of learning what goes where and why. Below is the general diagram what the circuitry used for this project.
Below is the beginning of the code used for this project, like every project I start with defining the LEDs by their ‘name’ instead of the number they are on. This will make it easier later on in the code to control them.
Next is where I configure the LEDs to be outputs, using their new names.
Below is where I program the delays between the lights as you can see the creator of this code detailed out how it works.
The digitalWrite parts show the lights turning off and others turning on, with a delay between each of them (1000 representing 1 second)
This code was fairly simple to grasp so I chose to apply it to a more complex system.