
▲ 4 r/ArduinoHelp
Downloaded sketch doesn't work
I downloaded an arduino project online, but the code won't compile. Can someone help me?I get an error message that says:
In file included from C:\Users\joshu\AppData\Local\Temp\.arduinoIDE-unsaved2026314-15064-1n28yyq.xhpef\sketch_apr14a\sketch_apr14a.ino:1:
C:\Users\joshu\OneDrive\Documents\Arduino\libraries\HID-Project\src/HID-Project.h:35:2: error: #error HID Project can only be used with an USB MCU.
35 | #error HID Project can only be used with an USB MCU.
| ^~~~~
In file included from C:\Users\joshu\OneDrive\Documents\Arduino\libraries\HID-Project\src/HID-Project.h:39:
C:\Users\joshu\OneDrive\Documents\Arduino\libraries\HID-Project\src/SingleReport/SingleAbsoluteMouse.h:28:10: fatal error: HID.h: No such file or directory
28 | #include "HID.h"
| ^~~~~~~
compilation terminated.
exit status 1
Compilation error: exit status 1
Here's the code
#include "HID-Project.h"
//NOTE!! You need to add the above HID-Project library for this code to work.
//https://github.com/NicoHood/HID
//The device will show up as a gamepad/joystick in windows called "Seeed"
const int pinEject = 2;
const int pinArm = 3;
void setup() {
pinMode(pinEject, INPUT_PULLUP);
pinMode(pinArm, INPUT_PULLUP);
// Sends a clean report to the host. This is important on any Arduino type.
Gamepad.begin();
}
void loop() {
//check EJECT
if (!digitalRead(pinEject)) {
static uint8_t count = 0;
count = 0;
while (count<=2) {
count++;
Gamepad.press(1);
Gamepad.write();
delay(50);
Gamepad.release(1);
Gamepad.write();
}}
else {
Gamepad.release(1);
}
//Check ARM
if (!digitalRead(pinArm)) {
Gamepad.press(2);
Gamepad.release(3);
}
else {
Gamepad.release(2);
Gamepad.press(3);
}
Gamepad.write();
// Simple debounce
delay(50);
}
u/CaptainHunt — 9 days ago