epoch1970 wrote: > Wha?? > > Have you tried "gpio raspberry pi python" on google ?
On google! I searched on the forum, on RPi forum i open un post and i have a python script for manage GPIO but is only with MPD not LMS. I try change this script for LMS http://www.raspberrypi.org/phpBB3/viewtopic.php?f=65&t=17048&sid=b081c7bdc97882d2bca4bc66807eda87&start=25 If MPD playing music, GPIO is opens, if in pause/stop GPIO closes. script wrote: > > #!/usr/bin/env python > # -*- coding: utf-8 -*- > from mpd import MPDClient > import RPi.GPIO as GPIO > import time > > RELAIS_ACTIF=False > PIN_RELAIS=12 > > def relai(etat): > GPIO.output(PIN_RELAIS, etat) # Bascule le pin du relai à > l'état voulu > RELAIS_ACTIF=etat > > def main(): > # Test de lecture audio > client = MPDClient() > while(1): > try: > # Connection au client mpd et lecture du status > client.connect(host='localhost', port='6600') > client.password('password') > status=client.status() > > if status['state']=='play' and RELAIS_ACTIF is False: > relai(True) > elif status['state']=='stop' or > status['state']=='pause': > relai(False) > client.disconnect() > except: > print 'Erreur connection' > raise > time.sleep(1) # On fait dodo pendant une seconde, et on > recommence ! > > if __name__ == "__main__": > GPIO.setup(PIN_RELAIS, GPIO.OUT) # paramétrage du pin en > sortie > relai(False) > main() > ------------------------------------------------------------------------ TheD6Bel's Profile: http://forums.slimdevices.com/member.php?userid=58077 View this thread: http://forums.slimdevices.com/showthread.php?t=71077
_______________________________________________ discuss mailing list discuss@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/discuss