Setup: Scratch GPIO What is Scratch? Scratch is a beginner friendly way to program the Raspberry Pi, designed for those who have not programmed before and are put off by the random keyboard mashing type code normal programming typically produces. Programs are simply created by dragging and dropping various types of blocks together to produce a sequence of instructions to follow. The default character who is tasked with following all these instructions is “Scratch” the cat!

A typical program is shown below:

On the surface Scratch is deceptively simple, however do not let that fool you, there is a lot that can be done by putting a few blocks together and because you are not distracted by syntax and confusing commands, you can really focus bring your ideas to life and what you want to achieve.

Introducing Scratch GPIO Scratch GPIO was created by Simon Walters (@cymplecy) to allow Scratch to interact with physical hardware. Full details of Scratch GPIO is available on his website: http://cymplecy.wordpress.com/scratchgpio/

How to install Scratch GPIO Obtain Scratch GPIO Scratch GPIO is installed from a single setup file. If an internet connection is available, obtain the Scratch GPIO setup file by running the following command.

sudo wget http://goo.gl/Pthh62 –O install_scratchgpio5.sh

Or download the file directly on another computer and copy it to your Raspberry Pi SD-Card or a USB drive (see the TIPs below for details on how to access it on the Raspberry Pi): http://goo.gl/Pthh62 TIP: In the workshop, preconfigured SD-Cards are available which can also be connected to the USB of the Raspberry Pi. They will contain the required setup file.

Run the install script Run the script to install Scratch GPIO using the following command: sudo bash install_scratchgpio5.sh

It is as simple as that, Scratch GPIO is installed on your system!

If you have any problems, see the TIPs below for additional help.

Safely shutdown your Raspberry Pi Before we continue, you will need to shutdown and power off the Raspberry Pi so we can fit our hardware onto the GPIO pins. WARNING: It is advisable to only connect and disconnect hardware to the GPIO pins when the Raspberry Pi is switched off to avoid damage. If your Raspberry Pi automatically starts in the desktop, click on the red power button in the bottom right corner and select Shutdown from the menu which comes up. Or open a terminal window (by clicking on the Terminal icon or selecting from the menu). From the terminal type the command sudo shutdown -h now . When the green activity (ACT) LED on the Raspberry Pi has stopped flashing (for over 5 seconds) you can safely disconnect the power.

WORKSHEET: Put a big tick in the checkbox marked "I have installed Scratch GPIO!"

TIP 1: If you have a different user name to the default pi user, use the following command: sudo bash install_scratchgpio5.sh yourid

TIP 2: If you have copied the file to your Raspberry Pi SD-Card you can access it as shown below (depending if you have a NOOBS setup or not). When using NOOBS, only the RECOVERY partition of the SD-Card will be visible on many computers, so you can copy the file there. To access this partition on the Raspberry Pi it will need to be mounted before you can run the script: mkdir ~/recovery sudo mount –t vfat /dev/mmcblk0p1 ~/recovery sudo bash ~/recovery/install_scratchgpio5.sh

If using a basic imaged system (non-NOOBS), the file can be run directly from the BOOT partition: sudo bash /dev/boot/install_scratchgpio5.sh

TIP 3: If you have the files on a USB device, you can access the install_scratchgpio5.sh as follows: Insert the USB device or USB SD-Card reader with the Workshop SD-Card inside, into one of the Raspberry Pi's SD-Card. From the terminal, use the following command: sudo fdisk -l

This will list all the drives and partitions detected on the system (if it is not detected as sda1 you can adjust the commands as needed). mkdir ~/sdcard sudo mount –t vfat /dev/sda1 ~/sdcard sudo bash ~/sdcard/install_scratchgpio5.sh

How does it work? The broadcast block In addition to the normal Scratch blocks as shown above, Scratch is able to shout (called broadcast) messages to anything which is listening.

The Scratch GPIO Helper Scratch GPIO is a slightly modified version of standard Scratch which has an additional helper (scratch_gpio_handler.py) running in the background. The GPIO helper listens for any broadcast massages which it understands and controls the connected hardware accordingly.

Install our hardware First before we plug in our hardware, shut-down the Raspberry Pi if you haven't done so already (see above). The Pi-Stop should be connected to your Raspberry Pi GPIO header P1 using Location A (LEDs facing outwards), as follows:

SEE ALSO: For more information about Pi-Stop and how to use it: Discover: The Pi-Stop WORKSHEET: Put another tick in the checkbox marked "I have powered down the Raspberry Pi and fitted the Pi-Stop in location A"

Run Scratch GPIO Plug the power cable back into the Raspberry Pi and let it start up. If you are still in the Raspberry Pi terminal, start the desktop environment using: startx

When the desktop has reloaded, you will discover two new icons:

Scratch GPIO 5 is the standard version, while Scratch GPIO 5 plus provides additional support for several add-on boards. NOTE: If you are using a remote connection and X-Forwarding, you can run Scratch GPIO with the following commands: sudo cp ~/.Xauthority ~root/ sudo ~/scratchgpio5/./scratchgpio5.sh

Performing our first test with Pi-Stop When you switch on your Raspberry Pi you will probably see the Pi-Stop's Red and Yellow LEDs are ON. Once you have started Scratch GPIO and it has enabled the remote sensor connections, you may find that these LEDs have switched OFF or dimmed.

Take control The program starts with two default Broadcast blocks, with the messages pin26on and pin26off setup.

We can immediately control our Pi-Stop lights by clicking directly on each of the broadcast blocks to switch on or off the Red light of our Pi-Stop.

WORKSHEET: Put a final tick for this section in the checkbox marked "I have tested Scratch GPIO with the PiStop and it works!" NOTE: The Pi-Stop will be available in limited numbers from www.4Tronix.com next week. With more to be in stock shortly after. When available they will be sold in pairs, packs of four and classroom/workshop packs: Approximate price will be £5 for two Pi-Stops

See www.pihwardware.com for updates. To reserve some or to enquire about classroom/workshop packs: Contact me (Tim Cox) at [email protected]

Setup: Scratch GPIO - GitHub

details of Scratch GPIO is available on his website: http://cymplecy.wordpress.com/scratchgpio/. How to install Scratch GPIO. Obtain Scratch GPIO. Scratch GPIO ...

521KB Sizes 10 Downloads 283 Views

Recommend Documents

Scalatron Player Setup - GitHub
A CLI-Friendly Scalatron Template. 25. SCALATRON ... publishing (namely, installing Scala and using a network share for publication). On this path ... 1. download the Scalatron distribution, e.g. from http://scalatron.wordpress.com. 2. unzip the ...

XenGT Setup Guide - GitHub
Jan 8, 2015 - 3.5.1. Starting Xen Services by Default. # update-rc.d xencommons defaults ... network. (Assume the IP address of system could be acquired via ...

IDS Data Server in AWS Setup - GitHub
The “Template URL” must match the region you've ... hcp://region.s3.amazonaws.com/ids-‐dataserver-‐template.cf ... When you get an email back, you will.

LPC2148 GPIO Programming Tutorial.pdf
Its also quite evident that the most popular “hello world”. program in embedded systems programming is Blinky i.e a LED connected to pin on the. Microcontroller ...

Android: Setup
Feb 24, 2011 - On the next window, check the box directly to the left of your project you'd like to submit. ... Be sure not to click the wrong project's folder. You.

My Podcatching Setup. - Knightwise.com
The "Hardware" of my podcast player consists of my Android 2.1 powered HTC ... You don't HAVE to go for this specific model of course , any android phone with ...

My Podcatching Setup. - Knightwise.com
gpo update :This forces Gpodder to update all the podcast subscriptions and ... You don't HAVE to go for this specific model of course , any android phone with ...

Step 1: copy setup
delete this folder, or You will not be able to use it normally. Open the folder. Shared. Run setup.exe ... the data folders, write the folders' paths to the. DATA Paths dialog box. Repair 1 to 13 in turn. As picture shows, the data file is on the J:

Contacts setup for administrators
them as a user to your G Suite account. This gives them a primary address for sending mail and invitations. From your Google Admin console dashboard, click.

setup dutch sub.pdf
Corporateservices in the netherlands firm24. Incorporation dutch asset protection structures setup stak . Mrdennnisdennnis gaming setup 2015! nl/dutch 720p ...

Groups setup for administrators
full email address and password. 2. Click Google Apps on the console's dashboard. 3. Click Groups for ... You can designate group managers on your team who can add/delete users for each group. ○ Only admins can .... solarmora.com. ○ Allow the Sol

MiG SFTP Setup
The screenshots are from an English Windows 8 with Firefox 29. Small deviations should be expected on other platforms and Firefox versions. It is also possible to use other platforms and SFTP clients as long as they support login with SSH key. It sho

Problem Set 0: Scratch
Sep 10, 2010 - form that may take a few minutes, so best not to wait until the very last ... you with an email address of the form [email protected], ...

Problem Set 0: Scratch
Sep 10, 2010 - dishonesty: you may not submit the same or similar work to this course that you have submitted or will submit to another. Nor may you provide or make available solutions to problem sets to individuals who .... a bit simpler than we exp

Problem Set 0: Scratch
Sep 10, 2010 - All work that you do toward fulfillment of this course's expectations .... For clues on a Mac, select About This Mac from your Apple menu and ...

lrwpanerrordistanceplot.cc ../scratch/lrwpanerrordistanceplot.cc: In ...
ns3/ptr.h:456:7: error: invalid use of incomplete type 'class ns3::SpectrumValue' m_ptr>Unref ();. ^. In file included from ./ns3/lrwpanphy.h:25:0, from ./ns3/lrwpanmac.h:32, from ./ns3/lrwpannetdevice.h:28, from ../scratch/lrwpanerrordistanceplot.cc

Problem Set 0: Scratch
Sep 10, 2010 - appropriateness of some discussion, contact the course's instructor. ... phone at 617-‐495-‐9000, in person in Science Center B-‐14, or via ...

Descargar setup minecraft.rar
... therun pc descargar gratisespañolsoftonic.descargar nitro pdflite.descargar ... mega.descargar gtasan andreas para xbox 360 slim.descargar opera mini next ...

Gopro Setup 02 -
... cable (+/- 50m). HDMI OUT. Thunderbolt. Qlab main out. MacBook Pro (late 2011). 2,8 GHz Intel Core i7. 8g RAM. SDI IN. BlackMagic UltraStudio Express.

Scratch-21stCenturySkills.pdf
Page 1 of 2. Scratch is a new programming environment developed by the Lifelong. Kindergarten research group at the MIT Media Lab (http://scratch.mit.edu).

Problem Set 0: Scratch
Sep 10, 2010 - appropriateness of some discussion, contact the course's instructor. ... phone at 617-495-9000, in person in Science Center B-14, or via email ...

Scratch Semi.pdf
Sign in. Loading… Page 1. Whoops! There was a problem loading more pages. Retrying... Scratch Semi.pdf. Scratch Semi.pdf. Open. Extract. Open with. Sign In.

Problem Set 0: Scratch
Sep 10, 2010 - phone at 617-495-9000, in person in Science Center B-14, or via email ... If you're running Windows (particularly a 64-bit version thereof) and ...

Scratch Programming
design your own sprites, how to clone them in Scratch 2.0, .... You don't need to install any software to use Scratch 2.0: it runs inside your browser, using an Internet connection. Scratch 2.0 needs a computer that can run the Adobe Flash Player, th