Unicorn hat WS2812 Error

#1

Hi
I just got the Unicorn Hat and followed all the instructions in the setup. I can get the Unicorn Hat working when I run file (lets say rainbow_blinky.py) in terminal. But I can’t seem to stop the program in terminal (doesn’t bring back the command prompt). Any hints to do that?

and second

I can’t run any python scripts using idle following the instructions as I get this error
Traceback (most recent call last):
File “/home/pi/test.py”, line 5, in
import unicornhat as unicorn
File “/usr/local/lib/python3.5/dist-packages/unicornhat.py”, line 35, in
ws2812.begin()
File “/usr/local/lib/python3.5/dist-packages/rpi_ws281x/rpi_ws281x.py”, line 124, in begin
raise RuntimeError(‘ws2811_init failed with code {0} ({1})’.format(resp, str_resp))
RuntimeError: ws2811_init failed with code -5 (mmap() failed)

I have tried installing the unicorn-hat repo following someone else’s similar issue solved by someone. Same error again. I might be doing something wrong here.

Running a raspberry pi 2 B v1.1 with Jessie.

Regards

0 Likes

#2

You need to run IDLE from the command-line with “sudo idle” since Unincorn HAT (or rpi_ws281x in particular) requires root access.

How are you attempting to stop the program? In all cases “Ctrl+C” should work.

0 Likes