Fader Unit
UNIT FADER is a Slide Potentiometer with color indicator, employ a 35mm slide potentiometer + 14x SK6812 programmable RGB lights. The fader has its own center point positioning, and excellent slide appliances for stable, reliable performance and precise control. The integrated beads support digital addressing, which means you can adjust the brightness and color of each LED light. The product is suitable for lighting, music control, and other applications.
Support the following products:
Micropython Example:
1# SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD 2# 3# SPDX-License-Identifier: MIT 4 5import os, sys, io 6import M5 7from M5 import * 8from unit import FaderUnit 9 10 11label0 = None 12label1 = None 13label2 = None 14label3 = None 15fader_0 = None 16 17 18def setup(): 19 global label0, label1, label2, label3, fader_0 20 21 M5.begin() 22 Widgets.fillScreen(0x222222) 23 label0 = Widgets.Label("Voltage:", 50, 80, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18) 24 label1 = Widgets.Label("ADC:", 50, 140, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18) 25 label2 = Widgets.Label("label2", 160, 80, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18) 26 label3 = Widgets.Label("label3", 160, 140, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18) 27 28 fader_0 = FaderUnit((8, 9)) 29 30 31def loop(): 32 global label0, label1, label2, label3, fader_0 33 M5.update() 34 fader_0.update_color() 35 label2.setText(str(fader_0.get_voltage())) 36 label3.setText(str(fader_0.get_raw())) 37 38 39if __name__ == "__main__": 40 try: 41 setup() 42 while True: 43 loop() 44 except (Exception, KeyboardInterrupt) as e: 45 try: 46 from utility import print_error_msg 47 48 print_error_msg(e) 49 except ImportError: 50 print("please update to latest firmware")
UIFLOW2 Example:
class FaderUnit
Constructors
Methods
- FaderUnit.get_voltage() float
Get the voltage of the Fader.
- 返回:
The voltage of the Fader.
UIFLOW2:
- FaderUnit.set_brightness(br: int)
This method is used to set the brightness of RGB lamp beads, and the setting range is 0-100.
UIFLOW2: