Arduino code that triggers a keyboard and mouse combo when it is moved on the Z axis at a certain speed
- Adafruit QT Py ESP32 Pico - WiFi Dev Board with STEMMA QT - 8MB Flash 2MB PSRAM
- ADXL343 - Triple-Axis Accelerometer (+-2g/4g/8g/16g) w/ I2C/SPI - STEMMA QT / Qwiic
- Adafruit LiIon or LiPoly Charger BFF Add-On for QT Py
- Lithium Ion Polymer Battery with Short Cable - 3.7V 420mAh
- STEMMA QT / Qwiic JST SH 4-Pin Cable - 50mm Long
Install right through the Libraries tool in Ardino.
Note: one thing that took me a bit of digging to find was the line "The STEMMA QT connector IO pins in Arduino are 19 (SCL1) and 22 (SDA1) and are available on Wire1." In other words, you construct the Adafruit_ADXL343 like
#include <Wire.h>
Adafruit_ADXL343 accel = Adafruit_ADXL343(0x53, &Wire1); # Address (first arg) doesn't matter apparently?
This one required a little digging. I started off using the ESP32-BLE-Keyboard and ESP32-BLE-Mouse libraries by T-vK, but found that they don't both work in the same sketch. Then I came across this issue: Support mouse and keyboard profile and I ended up using the ESP32-BLE-Combo library that does both. There is a more recent fork from alexz006, but I haven't had any problems with the Georgegipa fork, so I just stuck with that.
- Fix battery level code. I don't think it's currently accurate, but I don't know why.