编程语言
首页 > 编程语言> > microPython学习笔记4 NeoPixel灯带驱动

microPython学习笔记4 NeoPixel灯带驱动

作者:互联网

NeoPixel驱动程序

使用neopixel模块:

from machine import Pin
from neopixel import NeoPixel

pin = Pin(0, Pin.OUT)   # set GPIO0 to output to drive NeoPixels
np = NeoPixel(pin, 8)   # create NeoPixel driver on GPIO0 for 8 pixels
np[0] = (255, 255, 255) # set the first pixel to white
np.write()              # write data to all pixels
r, g, b = np[0]         # get first pixel colour

对于NeoPixel的低级驱动:

import esp
esp.neopixel_write(pin, grb_buf, is800khz)

标签:microPython,pin,灯带,NeoPixel,neopixel,np,import,255
来源: https://blog.csdn.net/weixin_43833645/article/details/122379990