I'm using my Pi as a media center, and I wanted to install some basic hardware controls on the casing.
Now, from various tutorials I've gotten as far as this:
- Code: Select all
#!/usr/bin/env python
from time import sleep
import os
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN)
while True:
if ( GPIO.input(23) == False ):
[do something]
sleep(1);
Thing is, I would like the 'do something' bit to be something like 'pretend the up arrow key is pressed', but I can't find how to say that in Python. This leads me to believe it's either really easy, or really hard.
Can it be done? Can you tell me how? Also, if it can be done, I'd like to run the script all the time, from startup. And I also use the GPIO to control a character LCD through lcdproc, can I use these things together, or do they conflict?