English
English
简体中文
日本語

UiFlow Tutorial

UiFlow1 Development Guide

Project Management

Use LTE network

UiFlow1 Blockly

Event

Unit

Unit Weight

Example

Gets the Weight of the Unit Weight weighing

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

weigh_0 = unit.get(unit.WEIGHT, unit.PORTA)

while True:
  print(weigh_0.weight)
  wait(0.1)
  if btnA.isPressed():
    wait(0.1)
    weigh_0.zero()
  wait_ms(2)

API

print((str('weight:') + str((weigh_0.weight))))
  • Read the raw weight value from the HX711
print((str('raw data:') + str((weigh_0.rawData))))
  • Obtain the scaled weight value based on calibration
weigh_0.set_calibrate_scale(200)
  • Calibrate the scale using a known weight
weigh_0.zero()
  • Set the tare weight to zero out the scale
Page Tools
PDF
On This Page