Keyboard Stroke

Hi Support,

I’m trying to program Arduino Leonardo to send a keystroke Enter and F6 after it detects a signal from a barcode scanner. Upon testing it, when I hit the switch, it will hit enter several times for each click. I tried putting letter A and it’s still doing it. Can you please help me?

Thanks.

It sounds like you are running into "switch bounce" - mechanical switches tend to bounce when they close - often many times in several ms before they settle down. For something like a lite, that is not an issue, but processors are fast enough to see that as several switch closures. You need to apply either software or hardware debounce to your system. Software is the easiest since it does not involve modifying the hardware - search here for "switch debounce" and you should find a number of examples.

Thanks a lot!