pdf-icon

UIFlow Guide

UiFlow1 Blockly

Event

Unit

UiFlow1 Project

Unit Relay

Example

Change the relay state (ON/OF) every second

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)
relay_0 = unit.get(unit.RELAY, unit.PORTB)

while True:
  relay_0.on()
  print('Relay ON')
  wait(1)
  relay_0.off()
  print('Relay OFF')
  wait(1)
  wait_ms(2)

API

relay_0.off()
  • Set the public terminal connection to the disconnected state
relay_0.on()
  • Set the public terminal connection to the connected state
On This Page