earlephilhower / arduino-pico

Raspberry Pi Pico Arduino core, for all RP2040 and RP2350 boards
GNU Lesser General Public License v2.1
1.96k stars 406 forks source link

Receiving HID Reports and using Keyboard.h simultaneously #2315

Closed nextu1337 closed 1 month ago

nextu1337 commented 1 month ago

I'm kind of new to this topic but what I'm trying to achieve is being able to receive WebHID reports sent like device.sendReport(ID, PACKET); in the firmware, I spent around 2 hours looking for a solution and I'm stuck. WebHID already recognizes the device and allows me to connect to it on the site but I can't seem to send reports, failing with DOMException: Failed to write the report.

Is it even possible to do with arduino-pico?

My current code looks something like this

#include <Arduino.h>
#include <Keyboard.h>

void setup() {
    Serial.begin(9600);
    Keyboard.begin();
    Keyboard.setAutoReport(false);
}

void loop() {
    // Receive any reports sent via WebHID and handle accordingly
}