Pages: [1]   Go Down
Author Topic: Switch on LED from keyboard  (Read 1828 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 10
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

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
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 614
Posts: 49376
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
http://arduino.cc/playground/Interfacing/Csharp
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 10
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks. It works.  smiley
Logged

Pages: [1]   Go Up
Jump to: