pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Reflective IR

案例程序

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

setScreenColor(0x222222)
reflective_ir_0 = unit.get(unit.REFLECTIVE_IR, unit.PORTB)

while True:
  print((str('analog:') + str((reflective_ir_0.get_analog_output()))))
  print((str('digital:') + str((reflective_ir_0.get_digital_output()))))
  wait_ms(2)

功能说明

print(reflective_ir_0.get_analog_output())
  • 读取反射 IR 单元的 ADC 值并返回一个整数值
print(reflective_ir_0.get_digital_output())
  • 读取反射 IR 单元的数字值并返回一个整数值
On This Page