Serial.println(joystick.getButton());
#endif
vertValue = joystick.getVertical() - vertZero; // read vertical offset
horzValue = joystick.getHorizontal() - horzZero; // read horizontal offset
if (vertValue != 0)
Mouse.move(0, (invertMouse * (vertValue / sensitivity)), 0); // move mouse on y axis
if (horzValue != 0)
Mouse.move((invertMouse * (horzValue / sensitivity)), 0, 0); // move mouse on x axis
if ((joystick.getButton() == 0) && (!mouseClickFlag)) // if the joystick button is pressed
{
mouseClickFlag = 1;
Mouse.press(MOUSE_LEFT); // click the left button down
}
else if ((joystick.getButton()) && (mouseClickFlag)) // if the joystick button is not pressed
{
mouseClickFlag = 0;
Mouse.release(MOUSE_LEFT); // release the left button
}
if (button == -1) {
#if DEBUG
Serial.println("No keypad detected");
#endif
delay(1000);
}
else if (button != 0) {
#if DEBUG
Serial.print("Qwiic Keypad Button: ");
Serial.println(button);
#endif
if (button == '0') {//note that this is a keypad '0' not the button press itself
Keyboard.write('0');
}
else if (button == '1') {
Keyboard.write('1');
}
else if (button == '2') {
Keyboard.write('2');
}
else if (button == '3') {
Keyboard.write('3');
}
else if (button == '4') {
Keyboard.write('4');
}
else if (button == '5') {
Keyboard.write('5');
}
else if (button == '6') {
Keyboard.write('6');