#! /usr/bin/env python
#-*- coding: utf-8 -*-
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(19, GPIO.IN) # GPIO 19 en entree
try:
while True: # boucle infini
input_state = GPIO.input(19)
if input_state == True: # si on detecte
print "detection !!!!"
time.sleep(1) # attent 1s avant de reprendre la boucle
except KeyboardInterrupt:
GPIO.cleanup()
exit