DrBwts
Posts: 2
Joined: Fri Jun 14, 2013 1:13 pm

Key stroke reading from keyboard?

Fri Jun 14, 2013 1:25 pm

Hi,

I would like to control a group of servos from a keyboard.

I have the servos up and running and can control them from inside a Python script but I would like there to be some user interaction. I was thinking about using the USB keyboard I have plugged into the RPi.

Ideally I would like the keyboard scanning to be done in the background and interupt the servos' behaviour only when a key stroke is detected. The servo behaviour being dependant on the which key is pressed.

At the moment though I would be happy with just being able to read a character from the keyboard. This seem like a simple thing but my web search has just ended up confusing me :(

Thanks for any help

Bwts

User avatar
davef21370
Posts: 897
Joined: Fri Sep 21, 2012 4:13 pm
Location: Earth But Not Grounded

Re: Key stroke reading from keyboard?

Fri Jun 14, 2013 2:49 pm

The PyGame module has very good event handling and is easy to implement, I'd try that.

Dave.
Apple say... Monkey do !!

DrBwts
Posts: 2
Joined: Fri Jun 14, 2013 1:13 pm

Re: Key stroke reading from keyboard?

Fri Jun 14, 2013 3:08 pm

Thanks Dave that's just what I was after.

Return to “Python”