pdf-icon

UIFlow Guide

UiFlow1 Blockly

Event

Unit

UiFlow1 Project

Unit Fader

Example

Read the original data of the sliding potentiometer's active position at 12 bits

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

screen = M5Screen()
screen.clean_screen()
screen.set_screen_bg_color(0xFFFFFF)
fader_0 = unit.get(unit.FADER, unit.PORTB)

fader_0.setColor(1, 0xff0000)
while True:
  print((str('darw:') + str((fader_0.readraw12()))))
  wait_ms(2)

API

fader_0.setColor(1, 0xff0000)
  • Set the color of a specified LED index
fader_0.setColorAll(0xff0000)
  • Set the color of all LEDs
fader_0.setColorAll(0xff0000)
  • Set the color of all LEDs
    • Palette
    • RGB
    • Hex
fader_0.setColorFrom(1, 5, 0xff0000)
  • Set the color of a range of LEDs (from to)
fader_0.setColorFrom(1, 5, 0x000000)
  • Set the color of a range of LEDs (from to)
fader_0.setColorFrom(1, 5, 0x000000)
  • Set the color of a specified LED index
fader_0.setColor(1, 0xff0000)
  • Set the color of a specified LED index
print((str('rew(12) data:') + str((fader_0.readraw12()))))
  • Read 12-bit raw data from the sensor
print((str('rew(16) data:') + str((fader_0.readraw16()))))
  • Read 16-bit raw data from the sensor
fader_0.setBrightness(0)
  • Set the brightness of all LEDs
fader_0.setBrightPOT()
  • Adjust the brightness potentiometer
fader_0.setColorPOT(1)
  • Set the number of adjustable LEDs for the brightness potentiometer
On This Page