Read PC keyboard (Linux) and set pin to low (grounding)

Hi,

Total newbie here. I need to set PIN6 to LOW when key s is pressed on PC's keyboard and when key s is no longer pressed, pin will be set to HIGH.

I did searching on web how to make this possible but all solutions uses bluetooth and on my project Arduino Uno is connected to PC via USB. Installed python2.7, pygame and PiSerial, idea is to utilize python and use that for controlling Arduino. Of course some code is needed inside Arduino as well.

Can you please help, at the moment I'm not sure from where to start. I know that this is trivial for most of members here. Thank you.

Your Python program needs to detect the keyDown and keyUp events (those may not be the exact names) and send a message to the Arduino when the key goes down and a different message when the key goes up.

If, for example, you want to detect the A key you could send ‘’ when the key goes down and ‘’ when the key goes up.

This Python - Arduino demo may help you get started.

…R

I did searching on web how to make this possible but all solutions uses bluetooth

The means of getting data from the PC to the Arduino does NOT depend on wired/wireless. The app on the PC should not even know if there are wires involved.