Thought I’d try the new Zero 2 with a bit of Unicornhat magic.
Sadly, it’s not working:
File "/usr/local/lib/python2.7/dist-packages/rpi_ws281x/rpi_ws281x.py", line 131, in begin
raise RuntimeError('ws2811_init failed with code {0} ({1})'.format(resp, str_resp))
RuntimeError: ws2811_init failed with code -3 (Hardware revision is not supported)
Segmentation fault
Tried these.
pi@raspberrypi:~ $ sudo pip install --upgrade rpi_ws281x
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already up-to-date: rpi_ws281x in /usr/local/lib/python2.7/dist-packages (4.3.0)
pi@raspberrypi:~ $ sudo pip3 install --upgrade rpi_ws281x
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already up-to-date: rpi_ws281x in /usr/local/lib/python3.7/dist-packages (4.3.0)
Have a look at line 131 of
File “/usr/local/lib/python2.7/dist-packages/rpi_ws281x/rpi_ws281x.py”
I’d guessing its checking to see what hardware is in use. And the Zero 2 W hasn’t been added yet.
Tried with python/python3
Tried with and without sudo, although it does require sudo, try without for the sake of…
Always the same segmentation error.
And here’s line 123 to 131 of “/usr/local/lib/python2.7/dist-packages/rpi_ws281x/rpi_ws281x.py”
Nowhere (in the entire file) does it mention ‘hardware’ ‘hard ware’ ‘zero’ or ‘pi’
def begin(self):
"""Initialize library, must be called once before other functions are
called.
"""
resp = ws.ws2811_init(self._leds)
if resp != 0:
str_resp = ws.ws2811_get_return_t_str(resp)
raise RuntimeError('ws2811_init failed with code {0} ({1})'.format(resp, str_resp))
Just tried the one line installer on a fresh Raspberry Pi OS install (installing things on the Zero 2 is so fast, wow!) and the examples seem to work ok - I’m running them with
Reimaged the OS
Installed the Unicornhat files with the one line installer.
BOOM!
pi@raspberrypi:~ $ cd /home/pi/Pimoroni/unicornhat/examples
pi@raspberrypi:~/Pimoroni/unicornhat/examples $ sudo python3 rainbow.py
Rainbow
Displays a beautiful rainbow across your HAT/pHAT :D
If you're using a Unicorn HAT and only half the screen lights up,
edit this example and change 'unicorn.AUTO' to 'unicorn.HAT' below.
Reticulating splines
Enabled unicorn poop module!
Pooping rainbows...
What I haven’t done yet, is to run any updates on the OS.
It’ll be interesting to see what happens when I do…
pi@raspberrypi:~ $ cd /home/pi/Pimoroni/unicornhat/examples
pi@raspberrypi:~/Pimoroni/unicornhat/examples $ sudo python3 rainbow.py
Traceback (most recent call last):
File "/home/pi/Pimoroni/unicornhat/examples/rainbow.py", line 6, in <module>
import unicornhat as unicorn
File "/usr/local/lib/python3.11/dist-packages/unicornhat.py", line 35, in <module>
ws2812.begin()
File "/usr/local/lib/python3.11/dist-packages/rpi_ws281x/rpi_ws281x.py", line 143, in begin
raise RuntimeError('ws2811_init failed with code {0} ({1})'.format(resp, str_resp))
RuntimeError: ws2811_init failed with code -3 (Hardware revision is not supported)
Segmentation fault