Welcome

This documentation will guide you through the methods available in the Blinkt! python library.

Blinkt! is a tiny Raspberry Pi add-on with 8, APA102, RGB LEDs which you can drive independently for notifications, lighting effects, animation effects and more!

At A Glance

blinkt.clear()[source]
blinkt.set_all(r, g, b, brightness=None)[source]
blinkt.set_brightness(brightness)[source]
blinkt.set_clear_on_exit(value=True)[source]
blinkt.set_pixel(x, r, g, b, brightness=None)[source]
blinkt.show()[source]

Set A Single Pixel

The bread and butter of Blintk! is setting pixels. You can set any of the 8 pixels on your Blinkt! to one of around 16 million colours!

The brightness argument is completely optional. Omit it to keep the last brightness value set for that particular pixel.

blinkt.set_pixel(x, r, g, b, brightness=None)[source]

Set the RGB value, and optionally brightness, of a single pixel

If you don’t supply a brightness value, the last value will be kept.

Parameters:
  • x – The horizontal position of the pixel: 0 to 7
  • r – Amount of red: 0 to 255
  • g – Amount of green: 0 to 255
  • b – Amount of blue: 0 to 255
  • brightness – Brightness: 0.0 to 1.0 (default around 0.2)

Set All Pixels

Sometimes you need to set all the pixels to the same colour. This convinience method does just that!

blinkt.set_all(r, g, b, brightness=None)[source]

Set the RGB value and optionally brightness of all pixels

If you don’t supply a brightness value, the last value set for each pixel be kept.

Parameters:
  • r – Amount of red: 0 to 255
  • g – Amount of green: 0 to 255
  • b – Amount of blue: 0 to 255
  • brightness – Brightness: 0.0 to 1.0 (default around 0.2)

Show

None of your pixels will appear on Blinkt! until you show() them. This method writes all the pixel data out to your device.

blinkt.show()[source]

Output the buffer to Blinkt!

Clear

Exactly the same as calling set_all(0,0,0), clear sets all the pixels to black.

You must also call show() if you want to turn Blinkt! off.

blinkt.clear()[source]

Clear the pixel buffer

Enable/Disable Clear On Exit

Sometimes you want a script that runs and quits, leaving a pattern up on Blinkt!

blinkt.set_clear_on_exit(value=True)[source]

Set whether Blinkt! should be cleared upon exit

By default Blinkt! will turn off the pixels on exit, but calling:

blinkt.set_clear_on_exit(False)

Will ensure that it does not.

Parameters:value – True or False (default True)

Constants

Blinkt! has 8 pixels. Simple. Use the constant NUM_PIXELS when you’re iterating over pixels, so you can avoid a magic number in your code.

NUM_PIXELS = 8