Finger Hat
The following products are supported:
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 hat import FingerHat 9 10 11label0 = None 12hat_finger_0 = None 13 14 15def setup(): 16 global label0, hat_finger_0 17 18 M5.begin() 19 label0 = Widgets.Label("label0", 4, 109, 1.0, 0xFFFFFF, 0x222222, Widgets.FONTS.DejaVu18) 20 21 hat_finger_0 = FingerHat(1, (26, 0)) 22 23 24def loop(): 25 global label0, hat_finger_0 26 M5.update() 27 label0.setText(str(hat_finger_0.get_user_list())) 28 29 30if __name__ == "__main__": 31 try: 32 setup() 33 while True: 34 loop() 35 except (Exception, KeyboardInterrupt) as e: 36 try: 37 from utility import print_error_msg 38 39 print_error_msg(e) 40 except ImportError: 41 print("please update to latest firmware")
UIFLOW2 Example:
stickc_plus2_finger_example.m5f2
class FingerHat
Constructors
- class FingerHat(id: Literal[0, 1, 2] = 2, port: list | tuple = None)
Create a FingerHat object.
- Parameters:
id – The ID of the UART, 0 or 1 or 2.
port – UART pin numbers.
UIFLOW2:
FingerUnit class inherits FingerUnit class, See unit.FingerUnit.Methods for more details.