pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Unit Grove2grove

Example

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

setScreenColor(0x252525)
grove_0 = unit.get(unit.GROVE2GROVE, unit.PORTB)

title0 = M5Title(title="UNIT GROVE2GROVE", x=84, fgcolor=0xFFFFFF, bgcolor=0x000000)

def buttonA_wasPressed():
  # global params
  grove_0.grove_Ctrl_Status(1)
  pass
btnA.wasPressed(buttonA_wasPressed)

def buttonB_wasPressed():
  # global params
  grove_0.grove_Ctrl_Status(0)
  pass
btnB.wasPressed(buttonB_wasPressed)

while True:
  if grove_0.grove_Ctrl_Status():
    print('is turn on')
  else:
    print('is turn off')
  print((str('Ameter') + str(((str((grove_0.grove_Ameter())) + str('mA'))))))
  wait_ms(1)
  wait_ms(2)

API

print(grove_0.grove_Ameter())
  • Get the current measured by the current Unit (mA)
print(grove_0.grove_Ctrl_Status())
  • Gets the current Unit status
grove_0.grove_Ctrl_Status(1)
  • Set Unit status
    • ON
    • OFF
grove_0.grove_Set_Vref()
  • Set the reference current to 0 mA
On This Page