newbie with Raspberry Pi - hardware button on gpio
#1
Hello experts,

I am a little frustrated with my Pi.
I want to set a music box (most time headless) with my Pi running RASPBMC (Frodo 12.2).
A little 16x2 LCD connected by LCDproc shows the important info.

Now I want to choose a radio stream with buttons connected to gpio. The Pi is playing the first entry in a playlist started at boot time (confluence skin) and it would be nice if I could implement a up, a down and a enter button to choose an other entry in the list.

I tried xbmc-command (https://github.com/mychris/xbmc-command) but there I could only take the "next" command which means that I must wait 10seconds for the Pi to start and show the next stream.

Buttons are working. If I hit a button I can see "button is pressed".
Code:
#!/usr/bin/env python
from time import sleep
import os
import RPi.GPIO as GPIO
import xbmc
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN)
GPIO.setup(22, GPIO.IN)
GPIO.setup(2, GPIO.IN)
while True:
if ( GPIO.input(17) == False ):
os.system('xbmc-command play-pause')
# print('17 gedrueckt')
if ( GPIO.input(22) == False ):
os.system('xbmc-command next')
# print('22 gedrueckt')
if ( GPIO.input(2)== False ):
# os.system('xbmc-command play-pause')
print('2 gedrueckt')
How could I get up, down and enter buttons running.
Thanks for helping a noob ...

Tobbes
Reply
#2
Have you seen this thread: http://forum.xbmc.org/showthread.php?tid...light=gpio
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply

Logout Mark Read Team Forum Stats Members Help
newbie with Raspberry Pi - hardware button on gpio0