Package: neopixel-plus
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?OverviewInstallationExampleNeoPixel classpinnstart_ledtestoverwrite_linedebugtargetNeoPixel functions (animations)4.1rainbow_animation()brightnessloop_limitduration_mspause_mscustomization_json4.2beats()brightnessbrightness_fixedloop_limitduration_mspause_msstartrgb_colorsnum_random_colorsmax_heightcustomization_json4.3moving_dot()brightnessloop_limitduration_mspause_a_mspause_b_msstartrgb_colorsnum_random_colorscustomization_json4.4light_up()brightnessloop_limitduration_mspause_mssectionsrgb_colorsnum_random_colorscustomization_json4.5transition()brightnessloop_limitduration_mspause_mssectionsrgb_colorsnum_random_colorscustomization_jsonNeoPixel functions (other)5.1get_sections()5.2get_led_selectors()sections5.3write()s_after_wait5.4get_led()istart5.5off()5.6on()num5.7color()rgb_colorcustomization_json5.8test_animations()5.9get_pin()Terminal commandsInstallationMake 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_plusExampleIMPORTANT:To use NeoPixel+ on Raspberry Pi (using target='adafruit'), you need to make sure you execute python with sudo.
For example:sudo pythonor from a virtual environmentsudo ./pyvenv/bin/pythonfrom 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()NeoPixel classInput:NeoPixel(pin=...)type=intdefault=10purpose='The GPIO pin the data wire of the LED strip is connected to'NeoPixel(n=...)type=intdefault=30purpose='The number of RGB LEDs on your LED strip'NeoPixel(start_led=...)type=intdefault=0purpose='With which LED should the animation start'NeoPixel(test=...)type=booldefault=Falsepurpose='If True: show LED simulation in terminal output. If False: connect to real LED strip and play animation.'NeoPixel(overwrite_line=...)type=booldefault=Truepurpose='If False: show all steps of LED animation in terminal ouput. Useful for debugging.'NeoPixel(debug=...)type=booldefault=Falsepurpose='If True: prints all function calls and their input variables, for better debugging.'NeoPixel(target=...)type=strdefault='micropython'options=['micropython','adafruit']purpose='Defines what kind of NeoPixel library is targeted: the default micropython NeoPixel or adafruits NeoPixel for Raspberry Pi.'NeoPixel functions (animations)rainbow_animation()Input:rainbow_animation(brightness=...)type=floatdefault=1.0purpose='Set the maximum brightness of the LEDs. 0 == off, 1.0 == 100%'rainbow_animation(loop_limit=...)type=intdefault=Nonepurpose='If set, defines how often animation should repeat, else: animation runs in infinite loop.'rainbow_animation(duration_ms=...)type=intdefault=1000purpose='Defines many ms should the animation last'rainbow_animation(pause_ms=...)type=intdefault=Nonepurpose='If set, defines if a pause should be made after animation and how long that lasts.'rainbow_animation(customization_json=...)type=dictdefault={}purpose='If you like, you can also give the customization options via a dict as an imput. Example: {"duration_ms":2000}'beats()Input:beats(brightness=...)type=floatdefault=1.0purpose='Set the maximum brightness of the LEDs. 0 == off, 1.0 == 100%'beats(brightness_fixed=...)type=booldefault=Falsepurpose='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.'beats(loop_limit=...)type=intdefault=Nonepurpose='If set, defines how often animation should repeat, else: animation runs in infinite loop.'beats(duration_ms=...)type=intdefault=200purpose='Defines many ms should the animation last'beats(pause_ms=...)type=intdefault=300purpose='If set, defines if a pause should be made after animation and how long that lasts.'beats(start=...)type=strdefault='start'options=['start','end','start + end','center']purpose='Defines from where the animation should start'beats(rgb_colors=...)type=listdefault=listofrandomlyselectedRGBcolors(example:[[140,140,144],[240,100,0]])purpose='Define what RGB colors the animation will use'beats(num_random_colors=...)type=intdefault=5purpose='Defines how many random RGB colors the animation will switch between, if no RGB colors are manually defined'beats(max_height=...)type=floatdefault=1.0purpose='Defines how high the beat animation can go. 1.0 == 100% of all LEDs, 0 == no LEDs.'beats(customization_json=...)type=dictdefault={}purpose='If you like, you can also give the customization options via a dict as an imput. Example: {"duration_ms":2000}'moving_dot()Input:moving_dot(brightness=...)type=floatdefault=1.0purpose='Set the maximum brightness of the LEDs. 0 == off, 1.0 == 100%'moving_dot(loop_limit=...)type=intdefault=Nonepurpose='If set, defines how often animation should repeat, else: animation runs in infinite loop.'moving_dot(duration_ms=...)type=intdefault=200purpose='Defines many ms should the animation last'moving_dot(pause_a_ms=...)type=intdefault=0purpose='Defines if pause A should be made and how long that lasts.'moving_dot(pause_b_ms=...)type=intdefault=300purpose='Defines if pause B should be made and how long that lasts.'moving_dot(start=...)type=strdefault='start'options=['start','end']purpose='Defines from where the animation should start'moving_dot(rgb_colors=...)type=listdefault=listofrandomlyselectedRGBcolors(example:[[140,140,144],[240,100,0]])purpose='Define what RGB colors the animation will use'moving_dot(num_random_colors=...)type=intdefault=5purpose='Defines how many random RGB colors the animation will switch between, if no RGB colors are manually defined'moving_dot(customization_json=...)type=dictdefault={}purpose='If you like, you can also give the customization options via a dict as an imput. Example: {"duration_ms":2000}'light_up()Input:light_up(brightness=...)type=floatdefault=1.0purpose='Set the maximum brightness of the LEDs. 0 == off, 1.0 == 100%'light_up(loop_limit=...)type=intdefault=Nonepurpose='If set, defines how often animation should repeat, else: animation runs in infinite loop.'light_up(duration_ms=...)type=intdefault=200purpose='Defines many ms should the animation last'light_up(pause_ms=...)type=intdefault=200purpose='Defines if pause should be made and how long that lasts.'light_up(sections=...)type=strorlistdefault='all'options=['all',0,1,2,3]purpose='Defines what sections of the LED strip should glow up (one section is 15 LEDs).'light_up(rgb_colors=...)type=listdefault=listofrandomlyselectedRGBcolors(example:[[140,140,144],[240,100,0]])purpose='Define what RGB colors the animation will use'light_up(num_random_colors=...)type=intdefault=5purpose='Defines how many random RGB colors the animation will switch between, if no RGB colors are manually defined'light_up(customization_json=...)type=dictdefault={}purpose='If you like, you can also give the customization options via a dict as an imput. Example: {"duration_ms":2000}'transition()Input:transition(brightness=...)type=floatdefault=1.0purpose='Set the maximum brightness of the LEDs. 0 == off, 1.0 == 100%'transition(loop_limit=...)type=intdefault=Nonepurpose='If set, defines how often animation should repeat, else: animation runs in infinite loop.'transition(duration_ms=...)type=intdefault=200purpose='Defines many ms should the animation last'transition(pause_ms=...)type=intdefault=200purpose='Defines if pause should be made and how long that lasts.'transition(sections=...)type=strorlistdefault='all'options=['all',0,1,2,3]purpose='Defines what sections of the LED strip should glow up (one section is 15 LEDs).'transition(rgb_colors=...)type=listdefault=listofrandomlyselectedRGBcolors(example:[[140,140,144],[240,100,0]])purpose='Define what RGB colors the animation will use'transition(num_random_colors=...)type=intdefault=5purpose='Defines how many random RGB colors the animation will switch between, if no RGB colors are manually defined'transition(customization_json=...)type=dictdefault={}purpose='If you like, you can also give the customization options via a dict as an imput. Example: {"duration_ms":2000}'NeoPixel functions (other)get_sections()Returns a list of all the LED strip sections (length: 15 LEDs per section).get_led_selectors()Returns a list of all the selector numbers to select specific LEDs in the strip.Input:get_led_selectors(sections=...)type=strorlistdefault='all'options=['all','random',0,1,2,3]purpose='Defines what sections should be returned.'write()Makes the LEDs glow in the color you defined. If test==True: simulates how the LEDs would glow.Input:write(s_after_wait=...)type=floatdefault=1.0/36.0purpose='Defines how many seconds the code should wait after writing the LED status.'get_led()Get the number of an LED, to select it for changing its color.Input:get_led(i=...)type=intpurpose='Defines which LED you want to get. If <0: LED from the end will be selected.'get_led(start=...)type=strdefault=Nonepurpose='Defines from where your animation starts. If start==end: LEDs will be counted from the end of the LED strip.'off()Turns all LEDs off.on()Turns all or specific LEDs on (make them glow white, 100% brightness).Input:on(num=...)type=intdefault=Nonepurpose='Turn on only one specific LED.'color()Turn on all LEDs in a specific RGB color.Input:color(rgb_color=...)type=listpurpose='Define an [r,g,b] list with the red, green and blue values (from 0-255).'color(customization_json=...)type=dictdefault={}purpose='If you like, you can also give the customization options via a dict as an imput. Example: {"rgb_color":[100,200,200]}'test_animations()Run all the different LED animations from NeoPixel+.get_pin()Returns the class object for the GPIO pin (micropython's and adafruit's NeoPixel use different classes for that).Terminal commandsYou 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>