Stop Light with buttons
12 Led's, 14 resistors, 2 buttons. All of this can be mounted on one bread board, I have them separated for visual.
1.
We set up each LED, with a resistor like this.
2.
We set up the button next.
Be sure to use a resistor like shown. a 10k ohm resistor is recommended.
3.
We now connect all of the bread boards RAILS together.
[NOTE: If your only using one bread board you can translate this step so all connections match, but only on one bread board.]
4.
We can now connect 3 of the top LED's to pins 2,3,4.
5.
We now connect the buttons to pins A0 A1.
The other [west] Led's are connected to pins A3, A4, A5.
6.
We now connect the East and West LED's together.
Red, to red, green to green, etc...
7.
We now connect the NORTH and SOUTH boards together.
Now that all our connections are done we can get the coding done.
8.
Software:
In this code there are some commented out lines, that you can use to see what's going on under the hood. Lots of comments are included.