Go Down

Topic: Switch on LED from keyboard (Read 3095 times) previous topic - next topic



I get my first arduino uno today morning. I`m really new in arduino, just wrote simple sketch which can turn on and off LED 13 by sending different symbols via serial monitor.

Now i want to switch on led when i`m press and hold button "O" (on my laptop keyboard), and switch off led when i release button. From what should i start? Maybe somebody give me an example or some manual.

Or may be another variant: small C# program with buttons ON LED and OFF LED

Arduino connected to my laptop via USB cable.

Please help


When you press a key on the computer an interrupt is generated. The interrupt causes the OS to capture the key press, and, with a Windows OS, generate a message that is sent to the current application. If that application deals with the key press message, that is the end of the message. If not, the message is passed up a chain of processes until it is handled by some process.

In order for that key press to get to the Arduino, the current application needs to make that happen. None of the applications that currently exist on your computer are likely to make that happen. You need to develop your own application to do that.

C# is a good choice, because it makes writing to the serial port, and reading from it. trivially easy.
The art of getting good answers lies in asking good questions.


Go Up