I personally love controlling NeoPixel with the ESP and MicroPython. In principle, you can quickly and easily implement your `DIY projects with it. Approx. 16 million colors are possible and the possibilities are almost endless, and they look fantastic.
It doesn't matter whether you use a NeoPixel Ring, Strip or Matrix! The code should always work with the adjustment of the number.
Important: From a certain number of NeoPixels, you need an additional power supply.
This example contains various functions to create effects with NeoPixel.
- mandatory 1x NeoPixel (ring, strip or matrix)
- few cables
- optional a breadboard
Example
# create new subdirectory
$ mkdir -p ~/Projects/ESP/examples/neopixel
# create script
$ touch ~/Projects/ESP/examples/neopixel/neopixel_basics.py
Source Code for
neopixel_basics.py
Check your circuit and copy the script to the microcontroller as main.py
.
# copy file into pyboard as main.py
(venv) $ rshell -p [SERIAL-PORT] cp examples/neopixel/neopixel_basics.py /pyboard/main.py
# start repl
(venv) $ rshell -p [SERIAL-PORT] repl
Start with keys Control
+ d
. Stop the loop with keys Control
+ c
. To leave the REPL, press keys Control
+ x
.
In this example, a string is converted into Morse code and displayed visually.
... same as previous example ...
... same as previous example ...
# create script
$ touch ~/Projects/ESP/examples/neopixel/neopixel_morse.py
Source Code for
neopixel_morse.py
Check your circuit and copy the script to the microcontroller as main.py
.
# copy file into pyboard as main.py
(venv) $ rshell -p [SERIAL-PORT] cp examples/neopixel/neopixel_morse.py /pyboard/main.py
# start repl
(venv) $ rshell -p [SERIAL-PORT] repl
Start with keys Control
+ d
. To leave the REPL, press keys Control
+ x
.