UIFlow Guide
驱动RGB灯带闪烁
from m5stack import *
from m5ui import *
from uiflow import *
setScreenColor(0x111111)
R = None
G = None
B = None
i = None
circle0 = M5Circle(95, 90, 15, 0xFFFFFF, 0xFFFFFF)
circle1 = M5Circle(220, 90, 15, 0xFFFFFF, 0xFFFFFF)
import random
while True:
R = random.randint(0, 255)
G = random.randint(0, 255)
B = random.randint(0, 255)
for i in range(0, 256, 10):
rgb.setColorFrom(6, 10, (R << 16) | (G << 8) | B)
rgb.setColorFrom(1, 5, (G << 16) | (R << 8) | B)
rgb.setBrightness(i)
for i in range(255, -1, -10):
rgb.setColorFrom(6, 10, (R << 16) | (G << 8) | B)
rgb.setColorFrom(1, 5, (G << 16) | (R << 8) | B)
rgb.setBrightness(i)
wait_ms(2)
rgb.setColorAll(0xff0000)
rgb.setColorAll(0x000000)
rgb.setColorAll(0x000000)
Palette
: 直接选择颜色面板进行切换灯带颜色RGB
: 输入RGB数值进行切换灯带颜色HEX
: 输入颜色转化而成的16进制数值进行灯珠颜色切换rgb.setColorFrom(6, 10, 0xff0000)
rgb.setColorFrom(6, 10, 0xff0000)
rgb.setColorFrom(6, 10, 0xff0000)
Palette
: 直接选择颜色面板进行切换灯带颜色RGB
: 输入RGB数值进行切换灯带颜色HEX
: 输入颜色转化而成的16进制数值进行灯珠颜色切换rgb.setColor(1, 0xff0000)
rgb.setColor(1, 0xff0000)
rgb.setColor(1, 0xff0000)
Palette
: 直接选择颜色面板进行切换灯带颜色RGB
: 输入RGB数值进行切换灯带颜色HEX
: 输入颜色转化而成的16进制数值进行灯珠颜色切换rgb.setBrightness(10)