pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Unit Watering

Example

from m5stack import *
from m5ui import *
from uiflow import *
import time
import unit

setScreenColor(0x222222)
Watering_0 = unit.get(unit.WATERING, unit.PORTB)

while True:
  print((str('Water: ') + str((Watering_0.get_adc_value()))))
  if (Watering_0.get_adc_value()) < 1000:
    Watering_0.set_pump_status(1)
  else:
    Watering_0.set_pump_status(0)
  wait(0.3)
  wait_ms(2)

API

print(Watering_0.get_adc_value())
  • Gets the raw ACD value of the Unit test
Watering_0.set_pump_status(0)
  • The state of the pump is set by variable 0/1 (ON/OFF)
Watering_0.set_pump_status(0)
  • Set the water pump status
    • ON
    • OFF
On This Page