Hardware Reference
In-Depth Information
4. Go back to the LXTerminal window and type the following command:
sudo python marshmallow.py
Now gently squeeze the marshmallow and your marshmallow message will be
printed to the LXTerminal window. If nothing happens, check that you have
pushed the pins into the marshmallow and cables as far as they will go.
Now that you have tested to see that your marshmallow button works, you need to
map it to a keyboard key so that when the marshmallow is pressed, the game will think
that the letter a on the keyboard is being pressed. his will become important when
you make or download a Scratch Marshmallow Game.
Mapping Marshmallow Input to a
Keyboard Key
Follow these steps to map your marshmallow button to a key on the keyboard:
1. In the LXTerminal window type:
cd Documents
wget https://launchpad.net/python-uinput/;
trunk/0.10.0/+download/python-uinput-0.10.0.tar.gz
his will download uinput , an application and library that you need to be able
to map your keyboard keys in your Python code. Once the .tar.gz ile is
downloaded, type the following command to extract the iles into your home
directory ( /home/pi ):
tar -zxvf python-uinput-0.10.0.tar.gz
Figure 8-14 shows the code for this step.
2. After the iles have been extracted, type:
cd python-uinput-0.10.0
python setup.py build
sudo python setup.py install
sudo modprobe uinput
If you reboot your Raspberry Pi, you will need to run the command sudo
modprobe uinput again in a terminal window, as the uinput driver will not
install by default.
Search WWH ::




Custom Search