I run the setup from this website to get my arduino to use AdaFruit LEDs. And also run:
sudo pip3 install adafruit-circuitpython-neopixel
I then made this python code:
import board
import neopixel
pixels = neopixel.NeoPixel(board.D18, 12, brightness=0.2)
pixels[0] = (255, 0, 0)
And then executed it with python filename.py
And got the error:
ImportError: No module named 'board'
I then thought I maybe need to use python3 (Because it every where says too)
So I typed:
python3 light-test.py
This time got some more output, but in the end again an ImportError:
File "light-test.py", line 2, in <module>
import neopixel
File "/usr/local/lib/python3.5/dist-packages/neopixel.py", line 34, in
<module>
from neopixel_write import neopixel_write
File "/home/pi/.local/lib/python3.5/site-packages/neopixel_write.py", line
15, in <module>
from adafruit_blinka.microcontroller.raspi_23 import neopixel as _neopixel
File "/home/pi/.local/lib/python3.5/site-
packages/adafruit_blinka/microcontroller/raspi_23/neopixel.py", line 3, in
<module>
import _rpi_ws281x as ws
ImportError: No module named '_rpi_ws281x'
So I don't know know what I am doing wrong.
You're right to use Python3 instead of Python2.
One solution suggested here is to build the rpi_ws281x code from source.
Before that, however, you could try running as a super user/ administrator as suggested here.
If you're missing the 'board' module, that gets installed with the following pip3 command:
sudo pip3 install adafruit-blinka
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With