Arduino toggle switch keyboard

I'm new, I don't know how to use toggle switch on-off to emulate one click. I want to move the lever up and send 1 letter, not e.g ggggggggggggggggggg just one g, and when i move back to down position, send next 1 g. I want to have it on one pin. Can someone show me an example?

You need to detect when the pin changes. Here is a tutorial: StateChangeDetection

When you detect the input going from OFF to ON, call Keybaord.write(ā€˜gā€™);.When you detect the input going from ON to OFF, call Keybaord.write(ā€˜gā€™);.

Thanks for help guys. I will see it

Can someone give me example with toggle switch?

hatiz:
Can someone give me example with toggle switch?

Follow the link in reply#1. It is an example. You just need to simplify it so that it doesn't discriminate between high-going and low-going transitions. That will be extremely easy, even for a beginner. There isn't any simpler answer, that isn't just writing code for you for free.

Thank you guys, it's working. You are awesome ;D