pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

Atomic Base

UIFlow 1.0 Project

Unit 8Angle

案例程序

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

setScreenColor(0x222222)
angle8_0 = unit.get(unit.ANGLE8, unit.PORTA)

while True:
  print(angle8_0.get_button_status())
  print(angle8_0.get_adc12_raw(0))
  print(angle8_0.read_status(0xFE))
  angle8_0.set_LED_RGB24(0, 50, 50, 50, 50)
  wait_ms(2)

功能说明

print(angle8_0.get_adc12_raw(0))
  • 从某通道(0-7)获取12为ADC的值
print(angle8_0.get_adc8_raw(0))
  • 从某通道获取8位的ADC数值
print(angle8_0.get_button_status())
  • 获取开关的状态
angle8_0.init_i2c_address(0x43)
  • 初始化设备的I2C通讯地址(默认0x43)
print(angle8_0.read_status(0xFE))
  • 获取固件的版本
angle8_0.set_i2c_address(0x43)
  • 设置I2C地址
angle8_0.set_LED_RGB24(0, 50, 50, 50, 50)
  • 设置某通道(0-7)的RGB值和亮度
angle8_0.set_LED_RGB24_From(0, 8, 50, 50, 50, 50)
  • 批量设置多通道(0-7)的RGB值和亮度
On This Page