The NeoPixel library plus animations and terminal testing mode - so you can see how your LEDs would behave directly in the terminal, without any microcontroller.
Want to support the development and stay updated?
-
NeoPixel functions (animations)
4.2 beats()
4.3 moving_dot()
4.4 light_up()
4.5 transition()
-
5.1 get_sections()
5.3 write()
5.4 get_led()
5.5 off()
5.6 on()
5.7 color()
5.9 get_pin()
Make sure Python 3 is installed.
Recommended: always create a Python Virtual Environment for your project and install neopixel_plus in that environment.
pip install neopixel_plus
IMPORTANT:
To use NeoPixel+ on Raspberry Pi (using target='adafruit'), you need to make sure you execute python with sudo. For example:
sudo python
or from a virtual environment
sudo ./pyvenv/bin/python
from neopixel_plus import NeoPixel
# Example 1 - Changing the color of a physical LED
pixel = NeoPixel(pin=5, n=30)
pixel.leds[0] = (219,100,222)
pixel.write()
# Example 2 - Testing a rainbow animation in the terminal
NeoPixel(test=True).rainbow_animation()
# Example 3 - Playing a rainbow animation on physical LEDs
NeoPixel(pin=5, n=30).rainbow_animation()
type = int
default = 10
purpose = 'The GPIO pin the data wire of the LED strip is connected to'
type = int
default = 30
purpose = 'The number of RGB LEDs on your LED strip'
type = int
default = 0
purpose = 'With which LED should the animation start'
type = bool
default = False
purpose = 'If True: show LED simulation in terminal output. If False: connect to real LED strip and play animation.'
type = bool
default = True
purpose = 'If False: show all steps of LED animation in terminal ouput. Useful for debugging.'
type = bool
default = False
purpose = 'If True: prints all function calls and their input variables, for better debugging.'
type = str
default = 'micropython'
options = ['micropython','adafruit']
purpose = 'Defines what kind of NeoPixel library is targeted: the default micropython NeoPixel or adafruits NeoPixel for Raspberry Pi.'
type = float
default = 1.0
purpose = 'Set the maximum brightness of the LEDs. 0 == off, 1.0 == 100%'
type = int
default = None
purpose = 'If set, defines how often animation should repeat, else: animation runs in infinite loop.'
type = int
default = 1000
purpose = 'Defines many ms should the animation last'
type = int
default = None
purpose = 'If set, defines if a pause should be made after animation and how long that lasts.'
type = dict
default = {}
purpose = 'If you like, you can also give the customization options via a dict as an imput. Example: {"duration_ms":2000}'
type = float
default = 1.0
purpose = 'Set the maximum brightness of the LEDs. 0 == off, 1.0 == 100%'
type = bool
default = False
purpose = 'If False: the brightness will start low and become high at the end. If True: the brightness stays the same during the animation, for all LEDs.'
type = int
default = None
purpose = 'If set, defines how often animation should repeat, else: animation runs in infinite loop.'
type = int
default = 200
purpose = 'Defines many ms should the animation last'
type = int
default = 300
purpose = 'If set, defines if a pause should be made after animation and how long that lasts.'
type = str
default = 'start'
options = ['start','end','start + end','center']
purpose = 'Defines from where the animation should start'
type = list
default = list of randomly selected RGB colors (example: [[140,140,144],[240,100,0]])
purpose = 'Define what RGB colors the animation will use'
type = int
default = 5
purpose = 'Defines how many random RGB colors the animation will switch between, if no RGB colors are manually defined'
type = float
default = 1.0
purpose = 'Defines how high the beat animation can go. 1.0 == 100% of all LEDs, 0 == no LEDs.'
type = dict
default = {}
purpose = 'If you like, you can also give the customization options via a dict as an imput. Example: {"duration_ms":2000}'
type = float
default = 1.0
purpose = 'Set the maximum brightness of the LEDs. 0 == off, 1.0 == 100%'
type = int
default = None
purpose = 'If set, defines how often animation should repeat, else: animation runs in infinite loop.'
type = int
default = 200
purpose = 'Defines many ms should the animation last'
type = int
default = 0
purpose = 'Defines if pause A should be made and how long that lasts.'
type = int
default = 300
purpose = 'Defines if pause B should be made and how long that lasts.'
type = str
default = 'start'
options = ['start','end']
purpose = 'Defines from where the animation should start'
type = list
default = list of randomly selected RGB colors (example: [[140,140,144],[240,100,0]])
purpose = 'Define what RGB colors the animation will use'
type = int
default = 5
purpose = 'Defines how many random RGB colors the animation will switch between, if no RGB colors are manually defined'
type = dict
default = {}
purpose = 'If you like, you can also give the customization options via a dict as an imput. Example: {"duration_ms":2000}'
type = float
default = 1.0
purpose = 'Set the maximum brightness of the LEDs. 0 == off, 1.0 == 100%'
type = int
default = None
purpose = 'If set, defines how often animation should repeat, else: animation runs in infinite loop.'
type = int
default = 200
purpose = 'Defines many ms should the animation last'
type = int
default = 200
purpose = 'Defines if pause should be made and how long that lasts.'
type = str or list
default = 'all'
options = ['all',0,1,2,3]
purpose = 'Defines what sections of the LED strip should glow up (one section is 15 LEDs).'
type = list
default = list of randomly selected RGB colors (example: [[140,140,144],[240,100,0]])
purpose = 'Define what RGB colors the animation will use'
type = int
default = 5
purpose = 'Defines how many random RGB colors the animation will switch between, if no RGB colors are manually defined'
type = dict
default = {}
purpose = 'If you like, you can also give the customization options via a dict as an imput. Example: {"duration_ms":2000}'
type = float
default = 1.0
purpose = 'Set the maximum brightness of the LEDs. 0 == off, 1.0 == 100%'
type = int
default = None
purpose = 'If set, defines how often animation should repeat, else: animation runs in infinite loop.'
type = int
default = 200
purpose = 'Defines many ms should the animation last'
type = int
default = 200
purpose = 'Defines if pause should be made and how long that lasts.'
type = str or list
default = 'all'
options = ['all',0,1,2,3]
purpose = 'Defines what sections of the LED strip should glow up (one section is 15 LEDs).'
type = list
default = list of randomly selected RGB colors (example: [[140,140,144],[240,100,0]])
purpose = 'Define what RGB colors the animation will use'
type = int
default = 5
purpose = 'Defines how many random RGB colors the animation will switch between, if no RGB colors are manually defined'
type = dict
default = {}
purpose = 'If you like, you can also give the customization options via a dict as an imput. Example: {"duration_ms":2000}'
Returns a list of all the LED strip sections (length: 15 LEDs per section).
Returns a list of all the selector numbers to select specific LEDs in the strip.
type = str or list
default = 'all'
options = ['all','random',0,1,2,3]
purpose = 'Defines what sections should be returned.'
Makes the LEDs glow in the color you defined. If test==True: simulates how the LEDs would glow.
type = float
default = 1.0/36.0
purpose = 'Defines how many seconds the code should wait after writing the LED status.'
Get the number of an LED, to select it for changing its color.
type = int
purpose = 'Defines which LED you want to get. If <0: LED from the end will be selected.'
type = str
default = None
purpose = 'Defines from where your animation starts. If start==end: LEDs will be counted from the end of the LED strip.'
Turns all or specific LEDs on (make them glow white, 100% brightness).
type = int
default = None
purpose = 'Turn on only one specific LED.'
Turn on all LEDs in a specific RGB color.
type = list
purpose = 'Define an [r,g,b] list with the red, green and blue values (from 0-255).'
type = dict
default = {}
purpose = 'If you like, you can also give the customization options via a dict as an imput. Example: {"rgb_color":[100,200,200]}'
Run all the different LED animations from NeoPixel+.
Returns the class object for the GPIO pin (micropython's and adafruit's NeoPixel use different classes for that).
You can also start an animation by calling the neopixel_plus.py file directly via your terminal.
Example:
python3 neopixel_plus.py -t <test> -d <target> -n <n> -a <animation>