MHeironimus / ArduinoJoystickLibrary

An Arduino library that adds one or more joysticks to the list of HID devices an Arduino Leonardo or Arduino Micro can support.
GNU Lesser General Public License v3.0
2.06k stars 403 forks source link

Can I use this library for two-way communication? #191

Open bert-laverman opened 3 years ago

bert-laverman commented 3 years ago

I have a set of buttons with built-in LEDs. Perfect for e.g. an MCP or such, where I push the buttons to engage the autopilot and have the led light up if the corresponding function actually engages. I found a nice C++ library that allows me to communicate with HID devices, and the Arduino Micro shows up properly. Detecting the buttons works fine, but now I need to be able to pass the led state from PC to Arduino, which means I need to send some kind of message and pick it up in the "DynamicHID.cpp" but has anyone worked out how to do this?

Cheers, Bert Laverman

VkTheProgrammer17 commented 3 years ago

so do you want the LED to turn on when you push the button?

bert-laverman commented 3 years ago

Yes and No: I do not want the Arduino to decide when the LEDs need to go on. That is up to what happens on the PC. So what I want is comparable to the CAPS-lock and such LEDs, where the PC sends a message (event? report?) to the Arduino telling it which LEDs must go on or off.

VkTheProgrammer17 commented 3 years ago

i dont think the library does that. you have to build some sort of mechanism for that function separately. i'm sure you'll find something on youtube

VkTheProgrammer17 commented 3 years ago

hey! i found something on youtube for what you need.https://www.youtube.com/watch?v=aMato4olzi8 you can wrap all of his code up in a function and use your push button like caps lock