Rework example code, fix bugs and get to compiling state. Also introduce missing logic for the Matrix code to keep track of what column is active.
This commit is contained in:
@ -0,0 +1,31 @@
|
||||
// A button box example using all of the button types.
|
||||
// This is the code used in the Black Box project.
|
||||
// TODO: add link to blog post, once it exists.
|
||||
|
||||
#include <Bounce2.h>
|
||||
#include <Joystick.h>
|
||||
|
||||
Joystick joystick;
|
||||
|
||||
void setup() {
|
||||
pinMode(13, OUTPUT);
|
||||
digitalWrite(13, LOW);
|
||||
|
||||
joystick.Init();
|
||||
// 3 toggle switches that emit a press every time they are toggled.
|
||||
// (in either direction)
|
||||
joystick.AddButton(2, BUTTON_PULSED_DOUBLE_ACTION);
|
||||
joystick.AddButton(3, BUTTON_PULSED_DOUBLE_ACTION);
|
||||
joystick.AddButton(4, BUTTON_PULSED_DOUBLE_ACTION);
|
||||
|
||||
// This button will stay 'held down' as long as the switch is on.
|
||||
joystick.AddButton(6, BUTTON_LATCHED);
|
||||
|
||||
// This button will emit a short press every time it is pushed, but
|
||||
// only one per push.
|
||||
joystick.AddButton(8, BUTTON_PULSED);
|
||||
}
|
||||
|
||||
void loop () {
|
||||
joystick.Update();
|
||||
}
|
Reference in New Issue
Block a user