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

nano scratchauto.sh

then type in following

cd /home/pi/scratchgpio5
sudo python scratchgpio_handler5.py &
scratch “/home/pi/Documents/Scratch Projects/autostart.sb”

If using ScratchGPIO6Alpha then do this instead

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

chmod +x scratchauto.sh

Create a Scratch Autostart script

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

autostart

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

Reboot your Pi and it should automatically run the Scratch autostart.sb file

Simon

2 thoughts on “Autostart ScratchGPIO project

  1. Don’t know what or if I am doing anything wrong – but can NOT get sGPIO6 to run with the RTK-003 board – also tried the ‘broadcast’ method for Pyonkee – but NoGo with sGPIO6 ; tested on both B and B+

    Used these comands to install GPIO6:

    wget http://git.io/nFwadg -O isgh6alpha.sh

    sudo bash isgh6alpha.sh

    jazza

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s