Virtual USB Keyboard problem.

Got to make a shield but having a problem in knowing where do I put the buttons in the schematic given below : http://www.practicalarduino.com/pics/virtual-usb-keyboard-schematic.jpg It is of the Virtual USB keyboard from practical arduino and needs 4 buttons attached to it. Please help. Thankyou. Regards Aman

do I put the buttons in the schematic given below :

You don't. In the absence of anything else you look at the rest of the software and see what pins the buttons are connected to, then use those pins. A link to the whole article would be good.

Sure. Here it is. http://www.practicalarduino.com/projects/virtual-usb-keyboard Please help. Can't just understand.!

The code says:-

define BUTTON_A 6

define BUTTON_B 7

define BUTTON_C 8

define BUTTON_D 9

define BUTTON_MSG 10

define BUTTON_ENTER 11

So wire the buttons between those pins and ground. That is button A6 to go to pin 6, Button B to go to pin 7 and so on.

Thanks there.!

Another thing, there are SIX buttons defined here but on the website, it says you need FOUR SPST push buttons. Would someone please correct me here and lead me the right way. Thank You.

Please help.

Are there 6 buttons in total ?

I'm also busy with the Virtual USB keyboard. I have just got mine working. It wasn't easy. First I used a breadboard. That did not work. The pc did not recognise the Arduino as USB-device. USB is very sensative to tiny disruptions. Thats why the breadboard version doesn't work. After I soldered all to the proto-shield it did work and the Arduino is recognised as USB-keyboard. However it is still sensative.

To see if the code and your set-up is working you can do this: Buttons A to Enter are on digital pins 6 to 11. The inputs 6 to 11 are set HIGH. So to activate a button all you need to do is to connect the pin to GND. For a quick test you can use a wire to connect the pin to GND for a short moment. but when you do this it often introduces the USB-device-not-recognised error and reconnecting the USB-cable is needed. To do it properly connect one side of a button to GND and the other side to the pin, preferably with a resistor in between.

To generate key-strokes automaticly you can do this:

change line:

if (digitalRead(BUTTON_D) == LOW) { UsbKeyboard.sendKeyStroke(KEY_D); digitalWrite(ledPin, !digitalRead(ledPin)); // Toggle status LED }

to:

i++; if (i == 30000){ i = 0; UsbKeyboard.sendKeyStroke(KEY_D); UsbKeyboard.sendKeyStroke(KEY_ENTER); }

The value 30000 is tricky. If its less than 10000 I get the infamous USB-device-not-recognised error. And be carefull 32767 is the maximum for an integer. I used the i++ to count 30000 cycli instead of a delay because delays can not be used in the loop. 30000 cycli amount to a delay of about half a second.

My aim is to link Arduino to Autohotkey. Arduino should send the key-strokes and AutoHotkey should take the corresponding actions. Therefore I intended to combine the USB loop with the other program. I'm afraid this will not work because there is no time in this program to do much more than check the button states. I think I need two Arduino's. One to check button states and generate key-strokes when a button is pressed and the other to run my program at normal speed and "press" the buttons when called for.

Good work there.! Got to get buzy with mine. Made a custom shield for my arduino. Hope it works.

After getting the Virtual USB Keyboard working I decided this would never become a reliable solution. To often the V-USB is not recognised. So I bought a Teensy and installed Teensyduino. Three days after ordering I have a working Teensy solution. This is so very simple to use. Loop{ Keyboard.print("s"); delay(5000);} and AHK recognises the keystrokes immediately.

However getting info from the pc back to Teensy between keystrokes might prove difficult. I'm working on that.