https://learn.adafruit.com/adafruit-qt- ... 2/overview
The product info states this version of the QTPY can be used as a USB device which is the main reason for choosing it.
I installed the ArduinoJoystick Library v2.0 in hopes to use Joystick.X() to relay and set up a single axis as a test in Windows USB Game Controller Setup.
https://github.com/MHeironimus/ArduinoJoystickLibrary
So far none of the samples or my test code will compile because they are missing PluggableUSB.h.
"Arduino\libraries\ArduinoJoystickLibrary-version-2.0\src/DynamicHID/DynamicHID.h:37:12: fatal error: PluggableUSB.h: No such file or directory
#include "PluggableUSB.h"
^~~~~~~~~~~~~~~~
compilation terminated."
Here is one of the shortest example codes from the library
Code: Select all
// Simple example application that shows how to read four Arduino
// digital pins and map them to the USB Joystick library.
//
// Ground digital pins 9, 10, 11, and 12 to press the joystick
// buttons 0, 1, 2, and 3.
//
// NOTE: This sketch file is for use with Arduino Leonardo and
// Arduino Micro only.
//
// by Matthew Heironimus
// 2015-11-20
//--------------------------------------------------------------------
#include <Joystick.h>
Joystick_ Joystick;
void setup() {
// Initialize Button Pins
pinMode(9, INPUT_PULLUP);
pinMode(10, INPUT_PULLUP);
pinMode(11, INPUT_PULLUP);
pinMode(12, INPUT_PULLUP);
// Initialize Joystick Library
Joystick.begin();
}
// Constant that maps the phyical pin to the joystick button.
const int pinToButtonMap = 9;
// Last state of the button
int lastButtonState[4] = {0,0,0,0};
void loop() {
// Read pin values
for (int index = 0; index < 4; index++)
{
int currentButtonState = !digitalRead(index + pinToButtonMap);
if (currentButtonState != lastButtonState[index])
{
Joystick.setButton(index, currentButtonState);
lastButtonState[index] = currentButtonState;
}
}
delay(50);
}
So my questions:
1. Can this QTPY be used as a USB Keyboard/Controller?
2. Is there a specific setting or option I should be looking for in the Arduino IDE to note using as a USB device?
3. Is PluggableUSB.h missing and should be in the core ide by default? The joystick library calls DynamicHID.h which references PluggableUSB.h but it is not in any core library. I just updated the IDE to 2.0.3 and updated all my libraries and board definitions so it should all be current.
Thank You!