SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
#183293
Hey gang-

I have a USB Host shield I am using with a Leonardo... I have the wiring done and passing all tests.

I have a regular old USB keyboard connected to it currently, and am looking for examples on how to passively allow the keyboard to pass-through the USB Host shield to the end device (PC or whatever)...

Using the Circuits @ Home library.. they have a keyboard example that outputs to serial monitor only.. (nothing gets passed along to the end device/PC)..

From my understanding I'd need to use the Keyboard.begin()..etc to pass along the data sent to serial monitor... and have added some lines to do so.. but am wondering if anyone else has been down this road before?

I found this old post:
http://hunt.net.nz/users/darran/weblog/ ... rough.html

but seems to not relate to the current state of the Circuits @ Home library..

before I move along to the effects/behavior I want to do.. I need to get the keyboard to work 'as normal' initially... so that is where I am at, step 1, 'emulating' the keyboard behavior, so it functions normally.




Other questions I have (after I get step 1 sorted out)

1.) I am trying to think of a way to 'slow down' the output of the key presses... kinda like if you PC is running out of resources, and the keys presses lag, and display on the screen slowly...etc..

thoughts were: (when in this 'mode/behavior' state).. I guess try to keep an 'array' (collection) of the key presses.. and then loop through displaying them with a 'delay' in between?

* Not sure how this will work or interfere with the polling of the keyboard presses though?

feedback? thoughts on this?


2.) I want to be able to trigger certain behavior over bluetooth.. so I figured an HC-05/HC-06 device connected, so I can trigger a certain keyboard layout over BT... or start this 'lag' behavior over bluetooth..

* I have worked/played a bit with the bluetooth modules.. and they are fairly simple/straightforward.. so its not about how to connect them, or parse the serial data..etc Its more about the 'whole' (bigger) picture of implementing this along side of the keyboard/pass-through stuff... I fear it might conflict with polling the keyboard?

feedback? thoughts on this aspect?


I'm guessing using a FSM coding approach would be best here? constantly polling the keyboard.. and then checking to see if serial data is available.. if yes.. parse, do whatever... and back to polling the keyboard?


either way.. thats just sharing some future ideas.. for now, I need a nice STABLE approach to getting all key press data over to the end device.

Any code or ideas, link, tuts even discussion is appreciated.


thanks!