pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Hat Beetlec

Example

The car rotates left and right, moves forward, and sets all lights to green.

from m5stack import *
from m5ui import *
from uiflow import *
import time
import hat

setScreenColor(0x111111)

hat_BeetleC_1 = hat.get(hat.BEETLEC)

hat_BeetleC_1.SetAllRGB(0x33ff33)
while True:
  hat_BeetleC_1.SetPulse(0, 255)
  hat_BeetleC_1.SetPulse(1, 0)
  wait(1)
  hat_BeetleC_1.SetPulse(0, 0)
  hat_BeetleC_1.SetPulse(1, 255)
  wait(1)
  hat_BeetleC_1.SetPulse(0, 255)
  hat_BeetleC_1.SetPulse(1, 255)
  wait(1)
  wait_ms(2)

API

hat_BeetleC_0.SetRGB(0, 0xff0000)
  • Set the RGB color at index 0 on BeetleC; currently set to red.
hat_BeetleC_0.SetAllRGB(0xff0000)
  • Set all RGB colors on BeetleC.
hat_BeetleC_0.SetPulse(0, 1)
  • Set the speed of the wheel on BeetleC.
On This Page