Skip to content

Error when setting pixel value to a list value (circuitpython 4.0.0beta) #39

Closed
@cpforbes

Description

@cpforbes

When setting a pixel with a list for the value:

>>> import board
>>> import neopixel
>>> NUMPIXELS = 16
>>> neopixels = neopixel.NeoPixel(board.D4, NUMPIXELS, brightness=0.2, auto_write=False)
>>> neopixels[1] = [0,0,0]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "neopixel.py", line 169, in __setitem__
  File "neopixel.py", line 148, in _set_item
TypeError: unsupported types for __add__: 'list', 'tuple'

This appears to be from the tuple addition used here:

r, g, b, w = value if len(value) == 4 else value+(0,)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions