5f7a8e5301
* update yotta defaults for 16kb devices * refactor deprecated blocks * updates for button events * update button events * update refference * update docs * update docs * update button event blocks * update docs * update block id
2.6 KiB
2.6 KiB
Button event
Returns the ID of one of these button event types:
- Pressed Down (1)
- Released Up (2)
- Clicked (3)
- Long clicked (4)
- Hold (5)
This block can be used to define the event type in on button event and on pin event.
Note, that by pressing a Button multiple events can raise at the same moment:
# | User input | Event raised |
---|---|---|
1 | Press A down | A.Down |
2 | Hold A for > 1.5 seconds | A.Hold |
3 | release A | A.Up |
A.LongClick |
# | User input | Event raised |
---|---|---|
1 | Press A down | A.Down |
2 | Press B down | B.Down |
3 | A+B.Down | |
Release A up | A.Up | |
A+B.Up | ||
A+B.Click | ||
Release B up | B.Up |
- Every Up-Event will always be followed by either a Click- OR Long-Click-Event, depending on how long the Down-Event has been ago.
Pressed Down
- For button
A
orB
: This handler works when the button is pushed down. - For
A
andB
together: This handler works whenA
andB
are both pushed down, at the moment the second button is pressed.
Released Up
- For button
A
orB
: This handler works when the button is released up. - For
A
andB
together: This handler works at the moment the first button is released up whileA
andB
are both pushed down.
Clicked
- For button
A
orB
: This handler works when the button is pushed down and released within 1 second. - For
A
andB
together: This handler works whenA
andB
are both pushed down, then one of them is released within 1.5 seconds of pushing down the second button.
Long clicked
- For button
A
orB
: This handler works when the button is pushed down and released after more than 1 second. - For
A
andB
together: This handler works whenA
andB
are both pushed down, then one of them is released after more than 1.5 seconds after pushing down the second button.
Hold
- For button
A
orB
: This handler works when the button is pushed down and hold for 1 second. - For
A
andB
together: This handler works whenA
andB
are both pushed down and hold for 1.5 seconds after pushing down the second button.
This is an advanced API. For more information, see the @boardname@ runtime messageBus documentation.