Files
loustique-home/composants/byPanda/bouton_servo.py

12 lines
214 B
Python
Raw Normal View History

2026-04-01 18:41:50 +02:00
import RPi.GPIO as GPIO
2026-04-02 22:20:07 +02:00
LDR_PIN = 20
2026-04-01 18:41:50 +02:00
2026-04-02 22:20:07 +02:00
def setup_ldr():
GPIO.setmode(GPIO.BCM)
GPIO.setup(LDR_PIN, GPIO.IN)
2026-04-01 18:41:50 +02:00
2026-04-02 22:20:07 +02:00
def lire_etat():
if GPIO.input(LDR_PIN) == GPIO.HIGH:
return "Nuit"
return "Jour"