connection:
Example code, led.py:
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
while(True):
GPIO.output(18, True)
time.sleep(1.5)
GPIO.output(18, False)
time.sleep(0.5)
Run it with sudo:
$ sudo python led.py
Next:
- Change GPIO LED brightness with GPIO.PWM
No comments:
Post a Comment