Raspberry Pi - blink a LED.md

This little program toggles an LED on and off forever.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#!/usr/bin/python

import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)      # Using PIN function not BOARD number #
GPIO.setwarnings(False)     # Turning off all warnings #

# Run while-loop forever #
while True:
    GPIO.setup(19, GPIO.OUT)
    print "Led on"
    GPIO.output(19, GPIO.HIGH)
    time.sleep(1)
    print "Led off"
    GPIO.output(19, GPIO.LOW)
    time.sleep(1)

blogroll

social