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:

FaderUnit

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:

example.png

cores3_fader_example.m5f2

class FaderUnit

Constructors

FaderUnit(port: tuple)

Initialize the Fader.

参数:

port (tuple) – The port to which the Fader is connected. port[0]: adc pin, port[1]: LEDs pin.

UIFLOW2:

init.png

Methods

FaderUnit.get_voltage() float

Get the voltage of the Fader.

返回:

The voltage of the Fader.

UIFLOW2:

get_voltage.png

FaderUnit.get_raw() int

Read the raw value of the ADC.

返回:

int from 0 to 65535.

UIFLOW2:

get_raw.png

FaderUnit.update_color() None

Update the color based on adc value.

UIFLOW2:

update_color.png

FaderUnit.update_brightness() None

Update the brightness based on adc value.

UIFLOW2:

update_brightness.png

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:

set_brightness.png

FaderUnit.fill_color(c: int)

This method is used to set the color of all RGB lamp beads, and the input value is 3-byte RGB888.

UIFLOW2:

fill_color.png

FaderUnit.set_color(i, c: int)

This method is used to set the specified RGB lamp bead color. The input value is the lamp bead index and 3-byte RGB888.

UIFLOW2:

set_color.png