Scratch

Scratch

ScratchHow to use The Scratch Programming Language with the BrickPi: a quick and easy introduction to BrickPi Scratch.

Our purpose here is to get you up and running using Scratch on the BrickPi.  Below we will walk you through a step-by-step on how to setup and run Scratch.  If you’re using our latest image for the BrickPi, you will have everything you need to get started on your SD card already.

Scratch is a graphical programming language available on the Raspberry Pi that “helps young people learn to think creatively, reason systematically, and work collaboratively . . .”  Scratch was developed at MIT to help young programmers get started, and is free for all to use.  Find more information on Scratch here.

Before Starting

We want to make Scratch as easy as possible to start up and run.  To follow these directions, you must use the Dexter Industries image.  You can find the image already written to an SD card on our website here.  Or you can download and install our Raspberry Pi image here.

Step 1: Connect to your Pi

If you haven’t already, see our guide to connecting to your Raspberry Pi.  You can setup the BrickPi as a desktop with a monitor and keyboard, connect to a PC or laptop with an Ethernet cable, or connect to it via wifi.  You can use any of these three ways to program BrickPi in Scratch.

Step 2: Start Your Raspberry Pi

Power up!  You should see the Raspberry Pi Desktop.

 

Step 3: Click on “BrickPi_Scratch_Start”

On your Raspberry Pi desktop, there should be an icon called “BrickPi_Scratch_Start” that looks like the Scratch Cat.  Click this icon.

Raspberry PI_Desktop with Scratch

You’ll see the terminal window open.  Do not close this window.  If Scratch is not running, you’ll see an error “Scratch connection error, Retrying”.  Not to worry.

BrickPi LEGO Robot Scratch is started but not connected

Step 4: Start Scratch

Start Scratch to begin controlling your robot!  Click on the Scratch Icon on the Raspberry Pi Desktop.

Step 5: Open an Example Project

In Scratch, go to File, Open . . . and select the examples from the directory “Desktop/BrickPi_Scratch/Examples”   After opening one of the examples, you should see a dialog box open in Scratch that says “Remote sensor connections enabled.”

If we check back to our terminal screen we started with the BrickPi_Scratch_Start button, we should see that a connection has started:  the screen now says “Connected to Scratch successfully”.   Try running an example program to see how it works!

 

Step 6: Start Programming

The best place to start is to look through our example programs, or one of the two documents below.

While we’ve learned a lot about Scratch the past few months, we aren’t experts.  We are looking for your feedback, and your improvements.  Please post questions, ideas, and problems to our forum here.

Notes

BrickPi_Scratch is written for Scratch1.4 (Linux) and may not work on other version.

Questions?

Point out a problem, suggest a solution, or contribute on our forum here.