Know when Keyboard buttons are pressed?

Hello, I'm a rookie with Arduino and am trying to figure out how to get a keyboard button press (the keyboard connected to the computer that the arduino is attached to via USB) in order for a line of code to execute (if the 'k' key is pressed, so and so happens).

I can get it to work partially but it has to be done via serial monitor and the enter button has to be pressed.

I am wondering if I can have the serial monitor closed and just have the arduino know when a key is pressed and unpressed.

any help would be awesome.

Hi,

you can use some buttons mounted on a breadboard, they would me more confortable. Anyway I don't know if there is a way to send keyboard inputs to Arduino from the IDE, but i'm pretty sure you could do this with an external program, thath reads your keyboard and send the input to the serial port, that Arduino is connected with. Try out with " http://Processing.org/ " just for the beginning. I was trying to do so too but later I quitted the project for no time. I would like to see what we can figure out. I'll also try by myself.

;)

Rolento: I am wondering if I can have the serial monitor closed and just have the arduino know when a key is pressed and unpressed.

Only if you write an application on the PC side to act as a key logger and then send the keys being pressed to the Arduino over serial.

What if you put the Arduino in-line between the keyboard and the computer. This would be easy with a ps2 keyboard.