Micropython学习交流群 学习QQ群:786510434 提供多种固件下载和学习交流。
Micropython-扇贝物联 QQ群:31324057 扇贝物联是一个让你与智能设备沟通更方便的物联网云平台
Micropython学习交流群 学习QQ群:468985481 学习交流ESP8266、ESP32、ESP8285、wifi模块开发交流、物联网。
Micropython老哥俩的IT农场分享QQ群:929132891 为喜欢科创制作的小白们分享一些自制的计算机软硬件免费公益课程,由两位多年从事IT研发的中年大叔发起。
NeoPixel WS2812 LED 驱动程序
使用neopixel模块:
代码1:
from machine import Pin
from neopixel import NeoPixel
pin = Pin(48, Pin.OUT)
np = NeoPixel(pin,1)
np[0] = (25, 25, 25)
np.write()
代码2:
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)
代码3:
import time
from machine import Pin
from neopixel import NeoPixel
pin = Pin(48, Pin.OUT)
np = NeoPixel(pin,1)
np[0] = (25, 25, 25)
np.write()
time.sleep(1)
np[0] = (125, 25, 25)
np.write()
time.sleep(1)
np[0] = (25, 125, 25)
np.write()
time.sleep(1)
np[0] = (25, 25, 125)
np.write()
time.sleep(1)
np[0] = (50, 50, 50)
np.write()
Copyright © 2014 ESP56.com All Rights Reserved
执行时间: 0.0066909790039062 seconds