Our first GPIO example will start from the very basics and build up a UK Pelican Crossing simulator using 5 x LEDs (A Red, Yellow and Green and another Red and Green for the Red and Green “man” indicators), 5 x 270Ω resistors and a single push-button for the pedestrians to control the lights.
Here is a picture of the finished board, but we’ll build it up in stages as we go, and finally present some software to make it all work:
In the photo, all the LEDs are on. This was just to test the connections – it would not normally be like that when running the controlling program!
Video Demo:
Absolutely fantastic project! Fun and simple 🙂
Thanks for this, I really enjoyed this project (and I learn’t a lot too). I was sent to this after purchasing http://www.amazon.co.uk/Electronic-Starter-Kit-Raspberry-Pi/dp/B0082LD2B8/ref=sr_1_1?ie=UTF8&qid=1342782083&sr=8-1
Glad you’re having fun! that’s the same SKPang kit I’m using, but I bought directly off their site rather than via amazon.
-Gordon
brilliant fun! thanks for sharing!
Is it possible to set the default behaviour of a pin so that it will work on boot without needing to set the mode?
Many thanks,
You can set the pull-up/down behaviour, but you can’t set the mode (in/out) or the level for an output – most pins on most Pi’s default to input on power-up.
-Gordon
Looks very nice, but is it possible to place a delay from when the button is pressed and when the lights change?
Yes.
Just edit the code and you’ll see where to put the delay in.
-Gordon