Autostart ScratchGPIO project

Sometimes it can be useful to make your Pi autorun something when it is switched on.

With ScratchGPIO, you can autorun a Scratch program (it doesn’t have to be one controlling the GPIO pins but ScratchGPIO is needed to make it autorun

There are 2 steps

Create Linux Script

Run LX Terminal

mkdir -p  /home/pi/.config/autostart

cd /home/pi/.config/autostart


then type in following

cd /home/pi/scratchgpio5
sudo python &
scratch “/home/pi/Documents/Scratch Projects/”

If using ScratchGPIO6Alpha then do this instead

cd /opt/scratchgpio6alpha
sudo python &
scratch “/home/pi/Documents/Scratch Projects/”
CTRL-X then Y to save

chmod +x

Create a Scratch Autostart script

Make the Scratch script include the following in its On Green Flag Event


Then press the Green Flag to set AutoStart to True and save it in /homepi/Documents/Scratch Projects as

Reboot your Pi and it should automatically run the Scratch file


Scratch 1.4 Messaging on Windows Computers for Schools

My ScratchGPIO for the Raspberry Pi can send messages between 2 computers so I’ve made a version that runs on Windows so that two windows PCs running Scratch 1.4 can send messages between themselves or to from a Pi

Its all alpha level at moment but if anyone fancies playing with it here is some rough instructions

On 1st PC

Install Python 2.7

Download these 2 files and save them in a folder

Run the program

Open up Scratch 1.4 and enable Remote Sensor Connections (or just open this file)

If you don’t know the IP of the computer – broadcast getip and then look at ipaddr sensor to find out what it is

On the 2nd PC – do exactly the same

then make up 2 blocks

When I recieve hello

say Hello for 2 secs

Then on 1st PC broadcast linka.b.c.d  where a.b.c.d is the ip address of the other computer

then you can broadcast send hello

and the 2nd PC should say hello