Hardware Reference
In-Depth Information
FIGURE 8-11 Pressing the button makes the LED light up!
CHALLENGE
Why not improve your code so that when you press the button once it turns on
the LED, and when you press the button again it turns off the LED?
The Marshmallow Challenge
Using the Raspberry Pi GPIO pins for electronic projects can be a great way to learn.
However, you can have some fun too. In this project, you will use your new GPIO pin
Python programming knowledge to use a marshmallow as an input button, map it to a
keyboard letter and use it to control a game that you have created in Scratch! Figure
8-12 shows the game in action.
You will need these items:
Two female-to-female jumper cables
Some marshmallows (yes, real ones!)
Two metal pins or metal paper clips
Your Raspberry Leaf to help you identify the GPIO pins that you need to use
Search WWH ::




Custom Search