Skip to content

New _pixelbuf based Neopixel object does not allow updating .buf #65

Closed
@sta-c0000

Description

@sta-c0000

ref: pull request #59
Before we could update pixels.buf (Neopixel obj) directly, but it does not work with new _pixelbuf based Neopixel.
Now it returns an error:

>>> type(pixels.buf)
<class 'bytearray'>
>>> pixels.buf = b'\x01\x04\x00\x01\x04\x00\x01\x04\x00\x01\x04\x00\x01\x04\x00\x01\x04\x00\x01\x04\x00\x01\x04\x00\x01\x04\x00\x01\x04\x00'
AttributeError: 'NeoPixel' object has no attribute 'buf'

Simple example for circuitplayground that works with current releases using old Neopixel object not using _pixelbuf:

from random import randint
import board
import neopixel
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10)
pixels.buf = bytearray(randint(0,255) for i in range(30)) # <=- now fails
pixels.show()

Thank you.

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