Add BUTTON_LATCHED_MOMENTARY type, to allow a pushbutton to mimic the behavior of a toggle switch.

This commit is contained in:
2021-11-01 15:24:05 -04:00
parent c37e4a6789
commit 6a692687f5
3 changed files with 37 additions and 3 deletions

View File

@ -0,0 +1,22 @@
// An example sketch using the joystick library.
// In this example, we have 3 toggle switches and 2 momentary pushbuttons.
// Each button is configured in a different one of the available behaviors.
#include <Bounce2.h>
#include <Joystick.h>
bool debug = false;
Joystick joystick(debug);
void setup() {
joystick.AddButton(9, BUTTON_PASSTHRU);
joystick.AddButton(10, BUTTON_LATCHED_MOMENTARY);
joystick.AddButton(11, BUTTON_PULSED);
joystick.AddButton(12, BUTTON_PULSED_DOUBLE_ACTION);
joystick.AddButton(13, BUTTON_PULSED_DOUBLE_ACTION_SPLIT);
joystick.Init();
}
void loop() {
joystick.Update();
}