Welcome to PyBlinkM’s documentation!

Drive a BlinkM with Python via I2C using python-smbus on Raspberry Pi.

$ sudo apt-get install python-smbus
$ sudo pip install pyblinkm
$ python
>>> from pyblinkm import BlinkM, Scripts
>>> blinkm = BlinkM()
>>> blinkm.reset()
>>> blinkm.play_script(Scripts.THUNDERSTORM)
>>> blinkm.reset()
>>> blinkm.fade_to(255, 0, 0)
>>> blinkm.fade_to_hex("ff0000")
>>> blinkm.go_to(0, 255, 0)

Contents:

module(name[, doc])

Create a module object. The name must be a string; the optional doc argument can have any type.

class pyblinkm.BlinkM(bus=1, addr=9)

Drop dead simple BlinkM control.

Parameters:
  • bus – I2C Bus
  • addr – I2C address
fade_to(r=0, g=0, b=0)

Fade to RGB Color.

fade_to_hex(hex_color)

Fade to Hexadecimal Color.

fade_to_hsb(h=0, s=0, b=0)

Fade to HSB Color.

Parameters:
  • h – Hue (0-360°)
  • s – Saturation (0-100%)
  • b – Brightness (0-100%)
fade_to_percent(percent=0)

Fade to color from Blue (Cold) to Red (Hot).

Takes an input from 0-100 and convert it to HSB from 180/100/100 to 0/100/100.

fade_to_random_rgb(r=0, g=0, b=0)

Fade to Random RGB Color.

get_rgb_color()

Get Current RGB Color.

Returns current red, green and blue channels.

go_to(r=0, g=0, b=0)

Go to RGB Color Now.

go_to_hex(hex_color)

Go to Hexadecimal Color Now.

play_script(script_number, repeat=0, start_line=0)

Play Light Script.

reset()

Stop script and fade to black.

set_fade_speed(fade_speed)

Set Fade Speed.

Parameters:fade_speed – fade speed from 1-255.
set_time_adjust(adjust)

Set Time Adjust.

Adjusts the playback speed of a light script.

Parameters:adjust – Relative adjustement between -128 and 127.
stop_script()

Stop playing script.

class pyblinkm.I2C(bus=1, addr=9)

I2C Connection Manager

Parameters:
  • bus – I2C Bus
  • addr – I2C address
class pyblinkm.Scripts

Default BlinkM Scripts Reference.

Indices and tables

Project Versions

Table Of Contents

This Page