本站改版新增arduino频道
Micropython开发ESP32开发板之控制WS28128 LED彩灯
from machine import Pin import neopixel,time pin = Pin(15,Pin.OUT) #1、传递引脚;2、灯珠数量;3、设备几种颜色,3种或者4种;4、频率,0=400K,1=800KHz np=neopixel.NeoPixel(pin,n=9,bpp=3,timing=1) #黄色,绿色,红色,蓝色,紫色,黄色,绿色,红色,蓝色 r_code=[255,0,255,65,160,255,0,255,65] g_code=[255,255,0,105,32,255,255,0,105] b_code=[0,0,0,255,240,0,0,0,255] def main(): np.fill((0,0,0)) np.write() while True: #np[5]=(0,255,0) #np.write() for i in range(0,9,1): np[i]=(255,255,i*8) np.write() time.sleep_ms(10) np.fill((0,0,0)) np.write() for j in range(0,9,1): np[j]=(r_code[j],g_code[j],b_code[j]) np.write() time.sleep_ms(10) np.fill((0,0,0)) np.write() if __name__=="__main__": main()
Copyright © 2014 ESP56.com All Rights Reserved
晋ICP备14006235号-22 晋公网安备14108102001165号
执行时间: 0.0097460746765137 seconds