I've got an Arduino Leonardo a couple of weeks ago and I'd like to make it work as a multimedia keyboard (one that selects tracks and changes volume).
I'd like to make it as a HID device, so I can control my Android tablet and PC
(if it is not possible, at least the tablet pc)
I tried to search in many places, but I don't know how to attach for example LUFA library...
Could you please provide a step by step tutorial, how to send commands from Arduino to tablet which will select next track and shift the volume?
Currently I'm using Keyboard.press(...);
But I cannot find a scan code for Next Track.
I recently picked up a Leonardo, and I found your post while looking for a way to do something similar with multimedia keys.
It took a while, but I updated a couple of Arduino source files that provide access to Volume, Track, and Playback controls on pretty much every device I've tried, including a Nexus 7 with OTG.
With this, you'd be able to do a Remote.next() to switch tracks, and Remote.increase() or Remote.decrease() to change the volume.
In case you're still interested, the source is available, along with a description of what had to be changed to make it work.
I was struggling with this as well with Android for a carputer. I wanted the pushbutton on a rotary encoder to go to the next track:
What I did to get it to work was take a lesser used key (in my case F23, Usage ID 114), and then edit /system/usr/keylayout/qwerty.kl and Generic.kl so that MEDIA_NEXT was changed from 163 to 193.
To determine the proper scancodes I used KeyEvent Display from the Play Store.