Control the on-board LED using Python |
pythonGPIO.py
import RPi.GPIO as GPIO
import time
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(16, GPIO.OUT)
for num in range(1, 5):
print num
GPIO.output(16, True) ##Turn OFF LED
print "LED OFF"
time.sleep(2)
GPIO.output(16, False) ##Turn ON LED
print "LED ON"
time.sleep(1)
Updated:
- Python/RPi.GPIO Control Raspberry Pi 2 B on-board ACT LED
- Python control Raspberry Pi 2 PWR/ACT LED, using RPi.GPIO or system's shell
No comments:
Post a Comment