pdf-icon

UIFlow Guide

UiFlow1 Blockly

Event

Unit

UiFlow1 Project

Unit Light

Example

Read the light intensity signal measured by the device

from m5stack import *
from m5stack_ui import *
from uiflow import *
import time
import unit

screen = M5Screen()
screen.clean_screen()
screen.set_screen_bg_color(0xFFFFFF)
light_0 = unit.get(unit.LIGHT, unit.PORTB)

while True:
  print(light_0.digitalValue)
  print(light_0.analogValue)
  wait(0.2)
  wait_ms(2)

API

print((str('analog:') + str((light_0.analogValue))))
  • Obtain the output data of the analog signal
print((str('digital:') + str((light_0.digitalValue))))
  • Obtain the digital signal output data
On This Page