I’m using an arduino leonardo to send keyboard messages to my Raspberry Pi
it’s working well in raspbian shell
when I run my OF program, the arduino leonardo is not recognized as a keyboard, but as a mouse (this is what I can understand)
I don’t if it is a OS problem (using two keyboards on Raspbian), or an OF problem…
I’m thinking there is a possibility to set up the “default keyboard” somewhere… I don’t know
Did you got this problem ?
I’ve just hooked up a Leonard and it’s events don’t get picked up as a regular keyboard.
Here’s what I see in the console for one Leonard Keyboard event:
[notice ] ofAppEGLWindow: readMouseEvents(): EV_KEY : unknown ev.code = 30
I’m not sure why it’s being picked up in readMouseEvents() and I’m not too experienced with OF/Arduino/USB HID. (I’d guess it’s something to do with Arduino’s Keyboard library implementation).
At least you can see the keycode, albeit in the wrong place.
Here’s a very hacky approach of getting that into your app:
In of/libs/openFrameworks/app/ofAppEGLWindow.cpp bellow this line
then in your ofApp.cpp file’s
cout << "from Leonardo: " << msg.message << endl;
As I mentioned, this is very hacky, I wouldn’t recommend meddling with the OF library itself.
Perhaps someone else on the forum can provide a more elegant solution.
Are you stuck to using the Leonardo as a Keyboard ?
If not, it might be simpler to use the typical Serial class in Arduino and ofSerial class on the OF side.
(Have a look at examples/communication/serialExample)
I think I will use ofSerial class instead of “keyboard library”