/******************************************************************************
Example_3c_Qwiic_HID_Mouse_Keyboard_Combined.ino
Written by: Ho Yun "Bobby" Chan
Date: February 6, 2020
Development Environment Specifics:
Arduino IDE 1.8.9
Description:
Based on the following examples:
- Jim's Pro Micro "HID Mouse/Keyboard"
- Wes' Qwiic Joystick "basic reading"
- Pete's Qwiic Keypad "read button"
This example controls the mouse with the Qwiic Joystick
and keyboard presses associated with the Qwiic Keypad.
The serial output is turned off so that Qwiic Pro Micro
can respond faster.
Libraries:
Mouse.h (included with Arduino IDE)
Keyboard.h (included with Arduino IDE)
Wire.h (included with Arduino IDE)
SparkFun_Qwiic_Joystick_Arduino_Library.h (included in the src folder) http://librarymanager/
All#SparkFun_joystick
SparkFun_Qwiic_Keypad_Arduino_Library.h (included in the src folder) http://librarymanager/Al
l#SparkFun_keypad
License:
This code is released under the MIT License (http://opensource.org/licenses/MIT)
******************************************************************************/
#include <Mouse.h>
#include <Keyboard.h>
#include <Wire.h>
#include "SparkFun_Qwiic_Joystick_Arduino_Library.h" //Click here to get the library: http://lib
rarymanager/All#SparkFun_joystick
JOYSTICK joystick; //Create instance of this object
#include "SparkFun_Qwiic_Keypad_Arduino_Library.h" //Click here to get the library: http://libra
rymanager/All#SparkFun_keypad
KEYPAD keypad1; //Create instance of this object
int vertZero, horzZero; // Stores the initial value of each axis, usually around 512
int vertValue, horzValue; // Stores current analog output of each axis
const int sensitivity = 150; // Higher sensitivity value = slower mouse, should be <= about 500
int mouseClickFlag = 0;
//int invertMouse = 1; //Invert joystick based on orientation
int invertMouse = -1; //Noninverted joystick based on orientation
//Debug mode, comment one of these lines out using a syntax