Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import RPi.GPIO as GPIO
- import time
- # Configuración del pin
- led = 17 # GPIO donde está el LED
- GPIO.setmode(GPIO.BCM) # Usar numeración BCM
- GPIO.setup(led, GPIO.OUT) # Configurar como salida
- try:
- while True:
- GPIO.output(led, GPIO.HIGH) # Encender LED
- print("LED Encendido")
- time.sleep(1)
- GPIO.output(led, GPIO.LOW) # Apagar LED
- print("LED Apagado")
- time.sleep(1)
- except KeyboardInterrupt:
- print("Saliendo...")
- GPIO.cleanup() # Restablecer configuración de los GPIO
Advertisement
Add Comment
Please, Sign In to add comment