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

From Catrobat
Jump to: navigation, search
Line 38: Line 38:
 
### select the Raspberry Pi model you are using.
 
### select the Raspberry Pi model you are using.
  
 +
 +
[[File:Device-2016-02-02-120459.png|border|200px]] [[File:Device-2016-02-02-120547|border|200px]]
 +
 +
Now you can add Raspberry Pi bricks in your Projects.[[File:Smile.png]]
  
 
== The Raspberry Pi Bricks and Sensor in a Nutshell ==
 
== The Raspberry Pi Bricks and Sensor in a Nutshell ==
 
test
 
test
  
[[File:Device-2016-02-02-120459.png|border|200px]]
 
  
 
== Tutorial 1: Blinking LED (Hello World) ==
 
== Tutorial 1: Blinking LED (Hello World) ==

Revision as of 17:10, 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.


Device-2016-02-02-120459.png 200px

Now you can add Raspberry Pi bricks in your Projects.Smile.png

The Raspberry Pi Bricks and Sensor in a Nutshell

test


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