Help with a toggle switch for a pc gaming board

I am building a PC gaming board using a Arduino Micro, I programmed a toggle switch to act as a multi key press of TAB+L, when ran in euro trucker 2 and fsx, it rapidly executed the the input. How would I calm it down to act as a one time hit action instead of a constant loop? the code I used to help me with this is the sample file of "move mouse with button press" Also I have only really started programming and messing with arduino for 3 weeks, so i am new to all this.

How would I calm it down to act as a one time hit action instead of a constant loop?

You have to show us your sketch if you want help.

If you want something to happen once, set a flag when you do that something.
If that flag is set you don't do that thing again.

.

Right sorry the code like i said was from a sample code so

Const Int tog1=1

Void setup
Pinmode (tog1, input)

Void loop
If (serial.available()>0)
Char inchar =serial read
Switch inchar
Case "tab+L
Break,

Its a ruff sketch of it any ways, like i said, I'm not even a novice at this, only a few hours doing this at best, so how does a flag work?

Unfortunately Gearsoftime, your sketch won't compile, let alone run.Probably what you should do is run through some of the Examples you get for free with the IDE. Look particularly at the Serial examples in the Examples > 04. Communication menu. This will get you started with a sketch that works, and you can then modify that.

Also please read the "How to use this forum" post at the top of the listing. It will help us help you.

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom.. :slight_smile: