//for a single line comment ("//"):
#define DEBUG 0 //0 = HID only
//#define DEBUG 1 //1 = HID with serial output
void setup() {
#if DEBUG
Serial.begin(9600);
Serial.println("Qwiic KeyPad Example");
#endif
if (joystick.begin() == false) {
#if DEBUG
Serial.println("Joystick does not appear to be connected. Please check wiring. Freezing..."
);
#endif
while (1);
}
if (keypad1.begin() == false) { // Note, using begin() like this will use default I2C addres
s, 0x4B.
// You can pass begin() a different address like so: keypad1.begin(Wire, 0x4A).
#if DEBUG
Serial.println("Keypad does not appear to be connected. Please check wiring. Freezing...");
#endif
while (1);
}
delay(1000); // short delay to let outputs settle
vertZero = joystick.getVertical(); // get the initial values
horzZero = joystick.getHorizontal(); // Joystick should be in neutral position when reading t
hese
#if DEBUG
Serial.print("Initialized. Firmware Version: ");
Serial.println(keypad1.getVersion());
Serial.println("Press a button: * to do a space. # to go to next line.");
#endif
Mouse.begin(); //Init mouse emulation
Keyboard.begin(); //Init keyboard emulation
}//end setup
void loop() {
keypad1.updateFIFO(); // necessary for keypad to pull button from stack to readable register
char button = keypad1.getButton();
#if DEBUG
Serial.print("X: ");
Serial.print(joystick.getHorizontal());
Serial.print(" Y: ");
Serial.print(joystick.getVertical());
Serial.print(" Button: ");