Controlling a Pimoroni PiGlow using ScratchGPIO

This is a little fun add on from the Pimoroni gang http://www.pimoroni.com with 18 high brightness LEDs on it.

To get an add-on like this to work on a Raspberry Pi (it uses what’s called the I2C protocol)  you need to run a few little things using LX Terminal.

sudo apt-get install i2c-tools

and

sudo apt-get install python-smbus

and finally a little tool to enable the I2C pins to be used for this purpose

wget https://github.com/heeed/pi2c/raw/master/pi2c.sh

followed by

sudo bash pi2c.sh

Then once you’ve rebooted – come back here :)

Make sure you’ve installed ScratchGPIO of course

PiGlowAddonOnce you’ve added I2C support to your Raspberry Pi then just create a variable called AddOn and set it to PiGlow as the first line in your Green Flag event.

You can then create variables Led1 to Led18 and set them to values between 0 (for off) to 255 (Fully on). You can also have variables for Red,Orange,Yellow,Green,Blue and White to refer to each of the colours and the the same for Leg1, Leg2 and Leg3.

PiGlowLegAs usual, you can use also use simple broadcasts instead of creating variables and say things like Broadcast Led1On to switch LED1 on

This script shows a how using the the join statement you can blink each leg in turn without having to use a lot of if statements.

About these ads

18 responses »

  1. For info – there’s a dead link here:
    “Make sure you’ve installed ScratchGPIO of course”

  2. […] Simon “Cymplecy” Walters has added Scratch support […]

  3. heamogoblin says:

    Hi Simon tried emailing you, was wondering if you got it? didn’t hear back from you
    James

  4. A Bryant says:

    Thanks for all the hard work.

  5. madwoollything says:

    I’ve very carefully followed the instructions given above (following the links to other pages and checking there are no error messages on each install) hoping the get the PiGlow working for my daughter to play with.

    Unfortunately the PiGlow has still not come to life and I wondering how else I can troubleshoot the system.

    Any help would be much appreciated.
    Thanks

  6. That line should read
    sudo bash pi2c.sh
    surely?

  7. Alex says:

    I cant get the pi glow working with Python,but no luck using ScratchGPIO4 or 4plus. I have followed you instructions to the letter. Any help would be appreciated.

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