Using Gobetwino to send keypress and hold the key


I am using Gobetwino to interface my Arduino with a computer game, some commands in the game rely on pressing a key down for some time. I'm trying to do this with gobetwino but I can't get it to do anything else than send a number of keypresses quickly after eachother but that doesn't fool the game :(

Any suggestions are welcome :)

We need more info then that. Posting your code is a good start. Also knowing the kind of key combos your trying to achieve will be useful as well.

Well there isn't much to show as code, the Arduino sends strings over Serial.writeln and the Gobetwino interprets them.

An example string is:

char buffer[5];

// SENDK command

      Serial.print(itoa((pId), buffer, 10));

This sends the A key to Gobetwino. I need the A key to stay pressed until I give a command to unpress it.

I'm afraid that is not possible.

The SENDK command in GoBetwino is built on top of a Windows API call called SendKeys. The purpose of SendKeys is to simulate typing.

I will double check the docs for SendKeys to see if theer is anything that can be done.

What happens in your game if you send the key over and over in a loop ?

When I send the command over and over in a loop the switch in the game (a simulator) is not pressed and nothing happens unfortunately.

I have now come up with an alternative solution using Gobetwino to launch a AutoIt script which on its turn sends a keydown command to the sim and use Gobetwino again to launch a AutoIt script to send a keyup command to the sim. This does work except there is a little bit of a delay before the script is executed which makes it not respond well in the game.

This is a link to the AutoIt software (freeware)

The AutoIt code I use is Send("{a down}"); and Send("{a up}");

A full Gobetwino solution would be much nicer since this would remove the inevitable script execution delay.