Driving RGB light strip flashing
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
: Directly select the color panel to switch the strip colorRGB
: Input the RGB value to switch the strip colorHEX
: Input color-converted hexadecimal values for switching lamp bead colors.rgb.setColorFrom(6, 10, 0xff0000)
? >Description|The right bead is the first to the fifth bead, the left represents the sixth to the tenth bead.
rgb.setColorFrom(6, 10, 0xff0000)
rgb.setColorFrom(6, 10, 0xff0000)
Palette
: Directly select the color panel to switch the strip colorRGB
: Input the RGB value to switch the strip colorHEX
: Input color-converted hexadecimal values for switching lamp bead colors.? >Instructions|Select different sides of the light strip and switch the adjustment mode to switch the color
rgb.setColor(1, 0xff0000)
rgb.setColor(1, 0xff0000)
rgb.setColor(1, 0xff0000)
Palette
: Directly select the color panel to switch the strip colorRGB
: Input the RGB value to switch the strip colorHEX
: Input color-converted hexadecimal values to switch lamp bead colors.rgb.setBrightness(10)