About
A package to ease the control of the blinkstick nano
Source code is at https://github.com/weshouman/advanced_led_control
Example
Save this example as test.py then run it as in the Usage section below
import advanced_led_control.models.colors as c
from advanced_led_control.models.leds import *
from advanced_led_control.models.ValueIndication import *
from advanced_led_control.models.Indicator import *
from advanced_led_control.models.Procedure import *
def indic1_func():
# Indication values are best shown between 1 and 10
value_indication = ValueIndication(c.RED, 10)
return value_indication
def indic2_func():
value_indication = ValueIndication(c.BLUE, NO_FLICKER)
return value_indication
indic1 = Indicator(m_col=c.GREEN, func=indic1_func, i_time=4)
indic2 = Indicator(m_col=c.GREEN, func=indic2_func, i_time=4)
stick = blinkstick.find_first()
procedure = Procedure(stick=stick, mode_led=LED_2, quiet=10, sync_duration=10)
# Append all indicators to be run
procedure.indicators.append(indic1)
procedure.indicators.append(indic2)
# Run the specified procedure
procedure.run()
Usage
This utility needs sudo to execute, as required by the blinkstick package.
If you are using a virtualenv, run
virtualenv -p python3 venv
pip install advanced-led-control
source venv/bin/activate
# Follow this [answer](https://stackoverflow.com/a/50335946/2730737) for why we need to use fully qualified path with sudo
sudo venv/bin/python test.py
If you are using sudo natively, run sudo -E python test.py
Configuration
Indicator Params
m_col: the indication mode color, based on any of the color types defined belowfunc: a callback that will be called to evaluate the color and flickering for the value led.brightness: a value in range [0, 1] that gets multiplied by both the mode and value indication.i_time: indication time, is how much time is allocated for this mode.
Indicator Callback
Returns
color: the indication value color, based on any of the color types defined below
NOTE: CSS names don't work with flickering, follow this reportflickering: an integer that shows the speed of flickering of this color, the higher the value the faster the flickering. Recommended Values are in range [1, 20]. UseNO_FLICKERor1001to set the led on without flickering.
Color Type
An indication color is either one of the 3 types
RGB: a list of 3 vals in RGB ie. [0, 10, 0].HEX: a string ie. '#00ffff'.CSS_NAME: a string ie. 'aliceblue'.
Procedure Params
-
mode_led: Choose betweenLED_1andLED_2, currentlyLED_1isn't supported as the blinkstick doesn't allow flickering the second led while the first is set constantly.
Follow this report. -
quiet: A percentage to be taken from the indication time for the stick to shutdown.
Settingquiet=0will disable this feature, and force all the indications to run consecutively.
Settingquiet=100is useless, as it will take all the indication time as a break! -
sync_duration: Allows starting the procedure at a specific second, as this package is made to run for multiple machines/RPis that are working separately, and to avoid using communication to control the led, we allow sync based on real time.
Use async_durationof at least 1.2 total indication time to count for the delay the pulses make, and if it's less than the total indication time, it will be almost useless.
NOTE: Setsync_duration=0to disable this feature.
NOTE: Settingsync_durationto say 8 will start at every eighth second, In example, [0, 8, 16, 24, 32 ...]
Notes
- This project was inspired by the Pi Dramble
Metadata
Release files for advanced-led-control 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| advanced-led-control-0.3.1.tar.gz | 9.6 kB | Without provenance | Details for advanced-led-control-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| advanced_led_control-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for advanced_led_control-0.3.1-py3-none-any.whl |
Total release size: 22.7 kB
Release files / advanced-led-control-0.3.1.tar.gz
| Download URL | advanced-led-control-0.3.1.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f5324c804c0972595c21c6a3d14eecca1887a6cc22180236d5f5a5c7694cab7f
|
|
BLAKE2b-256 checksum How to use checksums |
8a129c058171da48b11112498caa3d9263a17de9dd743a00f4df245c9406339b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.5.2
|
Release files / advanced_led_control-0.3.1-py3-none-any.whl
| Download URL | advanced_led_control-0.3.1-py3-none-any.whl |
|---|---|
| Size | 13.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
89d1a10f7961b92e25fd267229e0b4be37a2ea8bea4aa6800962431392f90a2c
|
|
BLAKE2b-256 checksum How to use checksums |
8bbb1604795b7559c33849b41b8d296046e721cb2eeb73af5f7229c5b5880a23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.5.2
|
Security for advanced-led-control 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.