Advertisement
rubenelportero

Controlando LED desde Raspberry Pi

Nov 28th, 2014
858
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. ## Codigo parpadeo de un LED en Raspberry Pi con python
  2. ##             http://ingenieroaburrido.com
  3.  
  4.  
  5. import RPi.GPIO as GPIO
  6. import time
  7. GPIO.setmode(GPIO.BCM)
  8. GPIO.setup(22, GPIO.OUT) ## GPIO 22 como salida
  9.  
  10. for i in range(30):  ## Bucle que se repetirá 30 veces
  11.         GPIO.output(22, True) ## Encendemos el LED
  12.         time.sleep(1) ## Esperamos 1 segundo
  13.         GPIO.output(22, False) ## Apagamos el LED
  14.         time.sleep(1) ## Esperamos 1 segundo
  15. GPIO.cleanup() ##Limpiamos los GPIO por si hubiese quedado alguno activo.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement