I have a raspi project in which I have to create a function to let a LED blink with different parameters.
Here´s the code.
Code: Select all
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
from threading import Thread
GPIO.setmode(GPIO.BOARD)
def blink(port, hz):
""" function let´s blink LEDs in variable speed and ports"""
GPIO.setup(port, GPIO.OUT)
while True:
GPIO.output(port, GPIO.HIGH)
time.sleep(0.5/hz)
GPIO.output(port, GPIO.LOW)
time.sleep(0.5/hz)
blink(16, 5)
I have tried it like this:
Code: Select all
...
blink(16, 5)
blink(15, 10)
Is there a way to start the second infinite loop, so both LEDs can blink?
Thank you.