pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Unit Kmeter

Example

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

setScreenColor(0x222222)
KMeter_0 = unit.get(unit.KMETER, unit.PORTA)

KMeter_0.init_i2c_address(0x66)
print((str('firmware version:') + str((KMeter_0.get_firmware_version()))))
print((str('I2C address') + str((KMeter_0.rw_i2c_address()))))
while True:
  print((str('thermocouple:') + str((KMeter_0.get_kmeter(1)))))
  print((str('Internal Temp:') + str((KMeter_0.get_kmeter(2)))))
  wait_ms(2)

API

KMeter_0.init_i2c_address(0x66)
  • Initializes the i2c address of the device. The default is 0x66
print(KMeter_0.get_firmware_version())
  • Obtain the firmware version of the device
print(KMeter_0.rw_i2c_address())
  • Obtain the i2c address of the device
print(KMeter_0.rw_sleep_time())
  • Get device sleep time
print(KMeter_0.get_kmeter(1))
  • Obtain the collection temperature
    • Thermocouple
    • Internal Temp
KMeter_0.rw_i2c_address(0x66)
  • Set the i2c address of the device
KMeter_0.rw_sleep_time(5)
  • Set device sleep time
KMeter_0.set_wakeup_timer(True)
  • Set device sleep time
On This Page