I am using a USB Host (Mini) Shield from Circuits @ Home:
And the library from here:
I am simply trying to connect a USB keyboard to this and use that for input in certain devices and/or PC's..
I have the USB Host Mini shield (with the +5v VBUS mod/jumper implemented to power the keyboard)
I have successfully ran the board_qc sketch, and gotten a response. Which tells me hardware wise, I am set-up correctly...
I then uploaded the USBHIDBootKbd example…
Here are my questions/behavior I want to test/add to the USBHIDBootKbd example.
1.) I took the USB keyboard, and plugged it into my laptop to test things out.
a.) when I plug the keyboard in normally, (without USB Host shield), both the laptop keyboard & the USB keyboard both ‘type’ text in the open application (notepad for example)
b.) when I plug in the USB keyboard using the USB Host shield (and the USBHIDBootKbd example sketch loaded).. I see the data in the serial monitor:
Start
DN >0A05<
ASCII: b
..etc..etc.
but the USB keyboard doesnt type/pass anything through to the applicaiton (notepad was used again and was in focus).. although I could still see the serial monitor data coming through? Is there a specific method/function/command to actually send the data/text typed from the USB keyboard TO the PC/application?
2.) Is there a way to stop all data from passing over to the PC/application/device?
Example: if I have a button/switch connected to an open/free I/O pin.. and when pressed, it stops all keypresses from being passed to the PC/device/app
3.) Can you conditionally chek the kaypress/data that is being sent and choose to send it or not? or even replace it?
Example 1:
If I press 'P', can I detect that shift + p keys were presssed/sent, and then NOT send it at all.. (skipping/discarding it, while continuing along with the rest of the text/data being sent to the PC/device?
Example 2:
If I press the character/key 'p', can I detect that, and then always send a capital 'P' *or another character, any character for that matter (say the 'o' character for example)
4.) As a first step,…when looking at the example sketch, I am was not sure where to 'hook' in, to start checking the 'character/data' being sent..
I tried to add this to the OnKeyPressed() function..
mykey = (char)key;
if(mykey == "p"){
//Keyboard.print("M");
Serial.println("P");
}
but I get this error:
ISO C++ forbids comparison between pointer and integer [-fpermissive], but I am not sure how?
I have a background in WEB programming (spoiled) and usually dont have to worry about memory/space or casting of vars to much... (which I think is part of the problem for the error I am getting), so I am lagging in getting to grips with all the tight/control that needs to be done in programming in C++ for hardware
If you could help answer the 2/3 questions, and help me understand how to use the library/example better I would appreciate it!
ps. if there is any other infor required to help solicit a response, please let me know.
thanks!