2015-11-12 05:31:09 +00:00
|
|
|
// 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.
|
|
|
|
|
2015-11-13 05:53:06 +00:00
|
|
|
#include <Bounce2.h>
|
2015-11-12 05:31:09 +00:00
|
|
|
#include <Joystick.h>
|
|
|
|
|
|
|
|
Joystick joystick;
|
|
|
|
|
|
|
|
void setup() {
|
|
|
|
pinMode(13, OUTPUT);
|
|
|
|
digitalWrite(13, LOW);
|
|
|
|
|
|
|
|
joystick.Init();
|
|
|
|
joystick.AddButton(2, BUTTON_PULSED_DOUBLE_ACTION);
|
|
|
|
joystick.AddButton(3, BUTTON_PULSED_DOUBLE_ACTION);
|
|
|
|
joystick.AddButton(4, BUTTON_PULSED_DOUBLE_ACTION);
|
2015-11-13 01:33:25 +00:00
|
|
|
joystick.AddButton(5, BUTTON_LATCHED);
|
2015-11-12 05:31:09 +00:00
|
|
|
joystick.AddButton(6, BUTTON_PULSED);
|
|
|
|
}
|
|
|
|
|
|
|
|
void loop () {
|
|
|
|
joystick.Update();
|
|
|
|
}
|