RaspberryPi GPIO Tutorial: LEDs and buttons
Link to this page: catrob.at/RaspberryPi
First steps with Raspberry Pi in Pocket Code: create blinking LEDs, use buttons as input
What you will learn:
- set up your Raspberry Pi
- control LEDs/outputs from Pocket Code
- use buttons/inputs from a Raspberry Pi in Pocket Code
If you encounter any bugs, please let us know and file a report. Thank you!
- 1 Install RaspberinoServer on your Raspberry Pi
- 2 Enable and Configure Raspberry Pi in Pocket Code
- 3 The Raspberry Pi Bricks and Sensor in a Nutshell
- 4 Tutorial 1: Blinking LED (Hello World)
- 5 Tutorial 2: Dimming a LED (PWM)
- 6 Tutorial 3: read input values
- 7 Tutorial 4: recognize input events (The invisible bird)
- 8 Further project ideas
- 9 Related articles
Install RaspberinoServer on your Raspberry Pi
For the following steps, you either have to enter the following commands in the terminal of your Raspberry Pi using a keyboard and a display, or you can connect to your Raspberry Pi via SSH from your computer or phone.
- Download the installer
wget http://catrob.at/installraspberino -O install-raspberino.sh
- Run the installer as root
sudo sh install-raspberino.sh
- Enter "y" to start the installation
- The installer downloads the server and installs everything. From now on the RaspberinoServer should be ready to use and start automatically when the Raspberry Pi is powered on.
- To update the server, just run the installer again (Step 2).
Enable and Configure Raspberry Pi in Pocket Code
If you haven't already done so, you'll have to enable and configure your Raspberry Pi under Settings in "Raspberry Pi bricks". Otherwise you can skip this section and move straight to the tutorials.
#tick the check-box to enable Raspberry Pi bricks #change the settings if necessary: ##enter IP-/Host-Address ###very often "raspberrypi" works as default host address ###if your RPi has a keyboard + monitor: find out the IP-address from a terminal via ifconfig ###your router might list all connected computers within the network ###if all of that fails: find out the IP-address via nmap ##Port ###the default is 10000 (don't change it unless you changed the script on the Raspberry Pi) ##GPIO version ###select the Raspberry Pi model you are using.
The Raspberry Pi Bricks and Sensor in a Nutshell