pdf-icon

UIFlow Guide

UiFlow1 Blockly

Event

Unit

UiFlow1 Project

Unit Reflective IR

Example

Infrared Ranging

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)
Copy

API

print(reflective_ir_0.get_analog_output())
Copy
  • Reads the ADC value of the reflected IR unit and returns an integer value
print(reflective_ir_0.get_digital_output())
Copy
  • Reads the numeric value of the reflected IR unit and returns an integer value
On This Page
Example
API
Q&A
Submit a question
Select question category*
Arduino
MicroPython
UIFlow1
UIFlow2
EzData
M5Burner
Software
Hardware
Other
Product name
Product version
Question description*
(Supports pasting screenshots.)
Attachments
Add Files
Email*
Submit
OK