Difference between revisions of "RaspberryPi GPIO Tutorial: LEDs and buttons"

From Catrobat
Jump to: navigation, search
Line 25: Line 25:
  
 
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.
 
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
    # '''tick''' the check-box to enable Raspberry Pi bricks
+
# change the settings if necessary:
    # change the settings if necessary:
+
## <u>enter IP-/Host-Address</u>
        ## <u>enter IP-/Host-Address</u>
+
### very often "'''raspberrypi'''" works as default 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 [https://learn.adafruit.com/adafruits-raspberry-pi-lesson-3-network-setup/finding-your-pis-ip-address via ifconfig]
            ### if your RPi has a keyboard + monitor: find out the IP-address from a terminal [https://learn.adafruit.com/adafruits-raspberry-pi-lesson-3-network-setup/finding-your-pis-ip-address via ifconfig]
+
### your router might list all connected computers within the network
            ### your router might list all connected computers within the network
+
### if all of that fails: find out the IP-address [http://raspberrypi.stackexchange.com/questions/13936/find-raspberry-pi-address-on-local-network via nmap]
            ### if all of that fails: find out the IP-address [http://raspberrypi.stackexchange.com/questions/13936/find-raspberry-pi-address-on-local-network via nmap]
+
## <u>Port</u>
        ## <u>Port</u>
+
### the default is '''10000'''
            ### the default is '''10000'''
+
###:(don't change it unless you changed the script on the Raspberry Pi)
            (don't change it unless you changed the script on the Raspberry Pi)
+
## <u>GPIO version</u>
        ## <u>GPIO version</u>
+
### select the Raspberry Pi model you are using.
            ### select the Raspberry Pi model you are using.
+
  
  

Revision as of 17:07, 19 August 2016

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!

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.

  1. Download the installer
    wget http://catrob.at/installraspberino -O install-raspberino.sh
  2. 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.

  1. tick the check-box to enable Raspberry Pi bricks
  2. change the settings if necessary:
    1. enter IP-/Host-Address
      1. very often "raspberrypi" works as default host address
      2. if your RPi has a keyboard + monitor: find out the IP-address from a terminal via ifconfig
      3. your router might list all connected computers within the network
      4. if all of that fails: find out the IP-address via nmap
    2. Port
      1. the default is 10000
        (don't change it unless you changed the script on the Raspberry Pi)
    3. GPIO version
      1. select the Raspberry Pi model you are using.


The Raspberry Pi Bricks and Sensor in a Nutshell

test

Device-2016-02-02-120459.png

Tutorial 1: Blinking LED (Hello World)

Tutorial 2: Dimming a LED (PWM)

Tutorial 3: read input values

Tutorial 4: recognize input events (The invisible bird)

Further project ideas

Related articles