Based on an article in the latest magpi online magazine – http://www.themagpi.com/ I’ve had a go at using the GPIO to control LED’s.
After a bit of fiddling around (rectifying my own mistakes with a wrong resistor!) I managed to get the type in program to work – basically you press the switch then the red LED produces between 1 and 6 flashes to represent a dice.
It was quite tricky to see when the counting started and stopped so with the help of a multitude of websites and python programming guesswork I fitted a further green LED to another of the IO pins. The alteration gives a green light to show it is on. When the switch is pressed the green light goes off and the red LED gives the flashes…. when done it goes back to green.
Its all very basic stuff and laughably useless (!) but I am really pleased that my first step in programing and electronics has resulted in something that works.
Here is a video so that you can witness the excitement (?) in real time:
and a still of the program itself:
I’m a bit too lazy to retype it so this pic will have to do! – pin 10 is the green LED, with the rest as in the magpi magazine.