adafruit / Adafruit_CircuitPython_NeoPixel

CircuitPython drivers for neopixels.
MIT License
302 stars 98 forks source link

Example error consult #144

Closed zkbutt closed 1 year ago

zkbutt commented 1 year ago

图片

Traceback (most recent call last): File "....t001.py", line 4, in pixels = neopixel.NeoPixel(board.NEOPIXEL, 1) AttributeError: module 'board' has no attribute 'NEOPIXEL'

zkbutt commented 1 year ago

图片 How do we solve this? Can we disable this restriction

Kasperror commented 1 year ago

图片 How do we solve this? Can we disable this restriction

If the board you're using is Raspberry Pi the solution sits in my PR #146 which authors did not approved yet.

Kasperror commented 1 year ago

图片

Traceback (most recent call last): File "....t001.py", line 4, in pixels = neopixel.NeoPixel(board.NEOPIXEL, 1) AttributeError: module 'board' has no attribute 'NEOPIXEL'

use hardware port instead, just like some examples show - board.D18 or board.D10 depending on the hadware you're using

caternuson commented 1 year ago

You can only use board.NEOPIXEL for boards that have a dedicated pin tied to a NeoPixel. General way to see what pins exist:

import board
dir(board)

A Raspberry Pi does not have a NEOPIXEL pin.

For the permissions issue, see PR linked above.

Closing since not an actual library issue.