is it possible to send data from the PC to the device? for example to control the keyboard LEDs
I noticed that the only function available is HID.SendReport(uint8_t id, const void * data, int len) but no one for read
dinodf:
is it possible to send data from the PC to the device? for example to control the keyboard LEDs
The "normal" way to send data from PC to an Arduino is the use some kind of serial connection, very often via USB.
Almost every programming language working on PC (Windows, Linux, Mac) can send and receive serial data.
And if you want to send Data "manually" there are several "terminal" applications for PC that will help you to send to or recive data from an Arduino through a serial (USB) connection.
You can find many examples regarding serial connection and Arduino.
There are also other methods to send (serial) data from the PC to an Arduino, like Bluetooth, WiFi and more.
As you did mention the "keyboard LEDs".
With Arduinos that can "act" as a HID device (32u4 based boards like Leonardo/Micro, Due and a Zero) it is possible to evaluate the state of the keyboard lock LEDs (caps lock, num lock, scroll lock) and also to change their states.
To my knowledge the standard HID library witch comes with the Arduino IDE can not do this, but there is a slightly modified version that can do this.
You can find it here: Leonardo keyboard leds emulation?
I have used it in some of my projects with success.
Thanks,
I know how to send and receive data via serial connections;
I had already seen the patch you linked but this only works to send the keyboard LEDs not for a generic HID hardware, for example for a 3D mouse that I am doing.
The specifications of the HID protocol provide for the possibility of data exchange between device and PC, how come the Arduino APIs have not foreseen their implementation?