pdf-icon

UIFlow Guide

UiFlow1 Blockly

Event

Unit

UiFlow1 Project

Unit RGB

Example

The RGB lights are flashing

from m5stack import *
from m5stack_ui import *
from uiflow import *
import time
import unit

screen = M5Screen()
screen.clean_screen()
screen.set_screen_bg_color(0xFFFFFF)
rgb_0 = unit.get(unit.RGB, unit.PORTB)

while True:
  rgb_0.setColor(1, 0xff0000)
  rgb_0.setColor(2, 0x33ff33)
  rgb_0.setColor(3, 0x3366ff)
  wait(0.1)
  wait_ms(2)

API

rgb_0.setBrightness(20)
  • Set brightness
rgb_0.setColor(1, 0xff0000)
  • Set the color of a specified LED light
rgb_0.setColorAll(0xff0000)
  • Set the color of all LED lights
rgb_0.setColorAll(0xff0000)
  • Set the color of all LED lights
rgb_0.setColorFrom(1, 3, 0xff0000)
  • Set the color of a specified range of LED lights
rgb_0.setColorFrom(1, 3, 0xff0000)
  • Set the color of a specified range of LED lights
rgb_0.setColor(1, 0xff0000)
  • Set the color of a specified LED light
rgb_0.setColor(1, 0x000000)
  • Set the color of a specified LED light (RGB)
On This Page