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:
8
example/obsolete/basic/Makefile
Normal file
8
example/obsolete/basic/Makefile
Normal file
@ -0,0 +1,8 @@
|
||||
TARGET_BOARD=arduino:avr:uno
|
||||
COM_PORT=/dev/ttyACM0
|
||||
|
||||
build:
|
||||
arduino-cli compile -b ${TARGET_BOARD}
|
||||
|
||||
upload:
|
||||
arduino-cli upload -b ${TARGET_BOARD} -p ${COM_PORT}
|
34
example/obsolete/basic/basic.ino
Normal file
34
example/obsolete/basic/basic.ino
Normal file
@ -0,0 +1,34 @@
|
||||
// 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 <Joystick.h>
|
||||
|
||||
bool debug = false;
|
||||
Joystick joystick(debug);
|
||||
|
||||
void setup() {
|
||||
// momentary pushbutton #1
|
||||
joystick.AddButton(9, BUTTON_PASSTHRU);
|
||||
|
||||
// momentary pushbutton #2 - this one will toggle on or off each time it is pushed
|
||||
joystick.AddButton(10, BUTTON_LATCHED_MOMENTARY);
|
||||
|
||||
// a toggle switch that acts like a momentary button - every time it's toggled 'on' it briefly sends
|
||||
// a keypresss
|
||||
joystick.AddButton(11, BUTTON_PULSED);
|
||||
|
||||
// like the above, but it sends its button press when toggled on *and* when toggled off
|
||||
joystick.AddButton(12, BUTTON_PULSED_DOUBLE_ACTION);
|
||||
|
||||
// again, similar to the above, but it sends two *different* button presses - 'on' will be one button, 'off' another.
|
||||
joystick.AddButton(13, BUTTON_PULSED_DOUBLE_ACTION_SPLIT);
|
||||
|
||||
// start up serial communication
|
||||
joystick.Init();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// check all the button states and send any changes
|
||||
joystick.Update();
|
||||
}
|
Reference in New Issue
Block a user