2013-01-31, 23:56
Hi!
(I'm very new to xbmc, python and programming in general, so I may say very stupid things. Please help me learn!)
The plan for my raspberry pi is a media center that can run, and be controlled, headless. Like a stereo set. I have an lcd working, now I want controls, and I want to use buttons hooked up to the gpio pins. The buttons work, but I can't get them to work with an xbmc python script.
The problem seems to be the permissions; the python plugin xbmc uses doesn't have root acces, which is required to use the RPi.GPIO python module.
Here's the code I've been using to check for button presses:
which works if I run it through SSH. The 'print...' bit is a placeholder.
Say I want this button to mean 'navigate right', I figured my code should be:
So my question is, how do I get this to work? That is, (I think,) how do I get xbmc the correct permission to do this? Or if someone has a different idea on how to do this, I'm all ears.
(I'm very new to xbmc, python and programming in general, so I may say very stupid things. Please help me learn!)
The plan for my raspberry pi is a media center that can run, and be controlled, headless. Like a stereo set. I have an lcd working, now I want controls, and I want to use buttons hooked up to the gpio pins. The buttons work, but I can't get them to work with an xbmc python script.
The problem seems to be the permissions; the python plugin xbmc uses doesn't have root acces, which is required to use the RPi.GPIO python module.
Here's the code I've been using to check for button presses:
Code:
import RPi.GPIO as GPIO
import time
GPIO.setmode(BCM)
GPIO.setup(22, GPIO.IN)
while True:
if ( GPIO.input(22) == False )
print("Button pressed")
time.sleep(0.1); #so I don't have to keep it pressed for too long.
Say I want this button to mean 'navigate right', I figured my code should be:
Code:
import xbmc
xbmc.ExecuteBuiltin("right")