Pynguins



Connect LED to 5th pin, top row from sd card side of pi.
#!/usr/bin/env python3
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)

led = 15
print("setup")
GPIO.setup(led, GPIO.OUT)
while True:
print("ouput")
GPIO.output(led, 1)
print("sleep")
time.sleep(1)
print("output2")
GPIO.output(led, 0)
time.sleep(1)
print(led)
GPIO.cleanup()

!/usr/bin/env python3
import RPi.GPIO as GPIO
import time
import random
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)

led = 15
GPIO.setup(led, GPIO.OUT)

while True:
GPIO.output(led, 0)
time.sleep(random.uniform(3,15))
t = time.time()
GPIO.output(led, 1)
input()
print(time.time()-t)

Comments | Gallery