PyUSB-based Blink(1) control library
This is a rewrite of ThingM’s original Python library. It includes the following modifications:
Use the pip utility to fetch the latest release of this package and any additional components required in a single step:
pip install blink1
Having checked out the blink(1) library, cd to python/pypi and run the setup script:
python setup.py develop
The simplest way to use this library is via a context manager.
import time from blink1.blink1 import blink1
- with blink1() as b1:
- b1.fade_to_color(100, ‘navy’) time.sleep(10)
When the blink1() block exits the light is automatically switched off. It is also possible to access the exact same set of functions without the context manager:
b1 = Blink1() b1.fade_to_rgb(1000, 64, 64, 64) time.sleep(3) b1.fade_to_rgb(1000, 255, 255, 255)
Unlike the context manager, this demo will leave the blink(1) at the end of execution.
The context manager supports a ”gamma” argument which allows you to supply a per-channel gamma correction value.
from blink1.blink1 import blink1
- with blink1(gamma=(2, 2, 2)) as b1:
- b1.fade_to_color(100, ‘pink’) time.sleep(10)
This example provides a gamma correction of 2 to each of the three colour channels.
Higher values of gamma make the blink(1) appear more colorful but decrease the brightness of colours.
The human eye’s perception of color can be influenced by ambient lighting. In some circumstances it may be desirable to apply a small colour correction in order to make colors appear more accurate. For example, if we were operating the blink(1) in a room lit predimenantly by candle-light:
- with blink1(white_point=’candle’, switch_off) as b1:
- b1.fade_to_color(100, ‘white’)
Viewed in daylight this would make the Blink(1) appear yellowish, hoever in a candle-lit room this would be perceived as a more natural white. If we did not apply this kind of color correction the Blink(1) would appear blueish.
The following values are acceptable white-points:
The library supports the following temperature names:
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|File Name & Checksum SHA256 Checksum Help||Version||File Type||Upload Date|
|blink1-0.0.12-py3-none-any.whl (11.6 kB) Copy SHA256 Checksum SHA256||3.4||Wheel||Jun 29, 2014|
|blink1-0.0.12.tar.gz (6.8 kB) Copy SHA256 Checksum SHA256||–||Source||Jun 29, 2014|