Dranoweb
Posts: 147
Joined: Thu Mar 20, 2014 3:01 pm

RaspBMC GPIO interface buttons [obsolete]

Tue Nov 04, 2014 1:04 pm

Hi,

My Project:
Ive constructed a proof-of-concept interactive display for my local military museum.

My Setup:
Using an original Model B with Raspbmc
I have 5 buttons connected to GPIO pins 17, 8,9,10, and 11
Pin 17 is a shutdown button and is watched by a bit of scripting inside RC.local.
There is alot more to the project but that's all I need explain for this purpose.

My Goal:
Make XBMC Play, Pause, Next, Back - when pressing buttons as mentioned above.

I have had success with this system in raspbian before, but through my research I have discovered that RaspBMC uses it's own version of the python interpreter, and I can't testrun scripts over SSH

EG: import xbmc fails, whereas running from /home/pi/.xbmc/userdata/autoexec.py works fine.

I'm looking for a way perhaps to loop code inside autoexec.py
while still ignoring my current code (that auto-plays a playlist)

My current code (autoexec.py):

Code: Select all

import xbmc
import os
xbmc.executebuiltin( "PlayMedia(/home/pi/.xbmc/userdata/playlists/video/all.m3u)" )
xbmc.executebuiltin( "PlayerControl(repeat)" )
#os.system("/home/pi/test.py")

Ignore the test file - I was experimenting.
Could I get away with a "while true" loop here?
I need to loop the script but ignore the autoplay functions at the top...

Return to “Interfacing (DSI, CSI, I2C, etc.)”