pdf-icon

UIFlow Guide

UiFlow1 Blockly

Event

Unit

UiFlow1 Project

Unit VMeter

Example

Measure voltage

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

setScreenColor(0x222222)
VMeter_0 = unit.get(unit.VMETER, unit.PORTA)

while True:
  print((str('Voltage: ') + str(((str((VMeter_0.voltage())) + str(' mV'))))))
  wait(0.3)
  wait_ms(2)

API

print((str('raw:') + str((VMeter_0.raw()))))
  • Obtain the raw value of the measured voltage data
VMeter_0.setGain(VMeter_0.PGA_256)
  • Set the maximum output voltage
VMeter_0.setMode(VMeter_0.MODE_CONTINUOUS)
  • Set the output mode
    • continuous
    • singleshot
VMeter_0.setRate(VMeter_0.RATE_8)
  • Set to acquire 8 samples per second
print((str('V:') + str((VMeter_0.voltage()))))
  • get Voltage
On This Page