SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By Erik63
#196399
Hello,

I am trying to send keyevent commands from my Leonardo to my Android tablet, part of a head unit. I can send the commands via ADB shell on my laptop, but I cannot figure out how to send them via the arduino.

I have been looking for weeks on how to do this, I have gotten some close hits (http://www.instructables.com/id/USB-Ped ... -Leonardo/) but they are in the area of sending the standard ASCII keyboard codes, and I am looking to send screen diming/brighten and sleep/wake.

Thanks,
-Erik
By Erik63
#196408
Thank you. Yes, I have looked into the ADK board but my impression was that it worked well for cases where you were trying to control an Arduino via the Android. I chose Leonardo since it appears as a HID to the Android, so I thought I could send keyevents to the Android. Correct me if I am wrong.

Thanks,
-Erik
By Erik63
#196426
Thanks for the info. I am a little confused as to how I emulate a keypress (for brightness and wake/sleep) via the ADK, I read through the doc at the link but I am not getting a picture as to how to do it. Do have any guidance?

-Erik
User avatar
By darrellg
#196440
I'm not familiar with how to do these things, but I'm pretty sure that keypress emulation isn't the way to do it. You'll need to explore the ADK library code and documentation to find the function calls you need to do what you want.
By Erik63
#196492
You are correct the keypress emulation did not work as needed. I bought an ADK and will see what I can do with that.

Thanks,
-Erik