#! /usr/bin/env python
#-*- coding: utf-8 -*-
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(22, GPIO.OUT) # GPIO 22 en OUTPUT (la led)
GPIO.setup(4,GPIO.IN) # GPIO 4 en INTPUT (la photoresistance)
GPIO.output (22, False) # led éteinte
while True:
lumiere = GPIO.input(4)
if (lumiere == 1):
GPIO.output (22, True)
else:
GPIO.output (22, False)