Skip to content

How to clear the NeoPixel's buffer data? #153

Closed
@xgqfrms

Description

@xgqfrms

How to clear the NeoPixel's buffer data?

Why is this code not working as I expect?

I think it might be a buffer data problem.

I had read the API docs, but did not find any method that can clear the buffer.

So, how to clear the buffer data?

./led-strip-test.py

#!/usr/bin/env python3
# coding: utf8

import board
import neopixel
from time import sleep

PIN = board.D18
# 0.3W/LED (30mA ~ 60mA)
LEDs = 30
ORDER = neopixel.GRB
pixels = neopixel.NeoPixel(PIN, LEDs, brightness=1.0, auto_write=True, pixel_order=ORDER)

while True:
  pixels[29] = (255, 0, 0)
  sleep(0.3)
  pixels[29] = (0, 255, 0)
  sleep(0.3)
  pixels[29] = (0, 0, 255)
  sleep(0.3)
# test
$ sudo ./led-strip-test.py

error / bug

I'm just confused about what's wrong with this.

The order in which the LEDs light up is very random and doesn't seem to be under my control.

Please See the video for the test results.

https://www.youtube.com/watch?v=KZjyptMkATs

wanted result

Only the 30th LED blinks.

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