ESP32-S3控制WS2812灯带显示异常,求解答

heatfire888
Posts: 1
Joined: Wed Mar 06, 2024 7:41 am

ESP32-S3控制WS2812灯带显示异常,求解答

Postby heatfire888 » Wed Mar 06, 2024 8:06 am

本人用ESP32S3设计一款产品,在用ESP32-S3控制WS2812灯带时出现多灯显示异常,灯珠无法正常显示。(颜色和位置都不对),异常率100%。

灯带用其他测试是好的,测试了几条都一样。

硬件环境是:ESP32-S3-DevkitC=1N16R8
软件环境: win10, Thonny, micropython.
代码:

from machine import Pin
import neopixel
#import ws2812
import time


GBIO_IN = Pin(40,Pin.OUT) # 控制信号输入引脚
LED_NUM = 15 # LED灯的数量


LED = neopixel.NeoPixel(pin=GBIO_IN, n=LED_NUM,timing=1) # 创建控制对象
LED.fill((0, 0, 0)) # GRB填充数据(RGB顺序, 0为不亮,255为全亮)
LED.write() # 写入数据
time.sleep_ms(1000)

LED[0] = (150,0,0) # 依次设置LED灯珠的颜色
LED[1] = (0,150,0)
LED[2] = (0,0,150)
LED[3] = (80,80,0)
LED[4] = (80,0,80)
LED[5] = (0,80,80)
LED[6] = (80,80,80)

LED.write() # 写入数据
time.sleep_ms(100)

请教问题出在何处?改如何解决?

谢谢

Who is online

Users browsing this forum: No registered users and 194 guests