Skip to content

Latest commit

 

History

History
86 lines (46 loc) · 1.23 KB

dualbutton.rst

File metadata and controls

86 lines (46 loc) · 1.23 KB

Dual_Button Unit

Support the following products:

Micropython Example:

import os, sys, io
import M5
from M5 import *
from unit import *


dual_button_0_blue = None
dual_button_0_red = None

def setup():
global dual_button_0_blue, dual_button_0_red

dual_button_0_blue, dual_button_0_red = DualButton((36, 26))
M5.begin()
Widgets.fillScreen(0x222222)

print(dual_button_0_blue.isHolding())

UIFLOW2 Example:

builder_html

class DualButton

Constructors

Create a DualButton object.

The parameters are:
  • IO1,IO2 Define two key pins.

UIFLOW2:

Methods

Dual_Button.isHolding()

The parameters are:

UIFLOW2:

Dual_Button.setCallback()

Execute the program when the key is pressed.

UIFLOW2:

Dual_Button.tick()

The polling method, placed in the loop function, constantly detects the state of the key.

UIFLOW2: