#PiGlow
This repository contains the library and examples for the PiGlow board.
To install on your Raspberry Pi, make sure you're running Raspbian, open LXTerminal or make your way to the terminal and run:
curl get.pimoroni.com/piglow | bash
This script will install the library and copy the examples in this repository to ~/Pimoroni/piglow
The PiGlow Python library is designed to support examples written for Jason's PiGlow library found here: https://github.com/Boeeerb/PiGlow
It's compatible with the examples, and we've ported some over to show you how it's done.
To use the piglow library, you'll probably want to start by importing it:
import piglow
Now, you can turn some LEDs on:
piglow.red(64)
Nothing will happen yet, you've got to update PiGlow with your changes. Why? Because it's quicker! If you're setting up a pattern it costs time and resources to redraw every step of that setup to the PiGlow, so we don't do that. Instead you need to call show
like so:
piglow.show()
A bug is a feature you can't turn off, however, so if you want to change that behaviour you can set it after importing piglow:
piglow.auto_update = True
This will turn on auto update, refreshing the PiGlow after each change so you don't have to.
##Function Reference
auto_update
- Set to True or False, determines if the PiGlow should automatically update after each LED changeclear_on_exit
- Set to True or False, determines if the PiGlow should be cleared on exit
white( value from 0 to 255 )
blue( value from 0 to 255 )
green( value from 0 to 255 )
yellow( value from 0 to 255 )
orange( value from 0 to 255 )
red( value from 0 to 255 )
arm( index from 0 to 2, value from 0 to 255 )
The set
method accepts a list of LEDs, a list of values, or a single LED or value, or any permutation therein:
set(0, 255)
- sets LED 0 to full brightness
set([1,3,5,7,9,11,13,15,17],255)
- sets all odd LEDs to full brightness
set(0,[50,50,50])
- let the 3 LEDs starting at index 0 to 50 brightness