I wrote a function to let a LED blink with variable parameters. The code looks like this:
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
from threading import Thread
GPIO.setmode(GPIO.BOARD)
def blink(port, hz):
""" Funktion zum Blinken von LEDs auf unterschiedlichen GPIO Ports und unterschiedlicher Hz angabe"""
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)
As far the code works well. Now I want to call the blink() function a second time with different parameters:
...
blink(16, 5)
blink(15, 10)
But with the first function calls a infinite Loop , the second call of blink() does not work. Is there a way to start a second infinite loop?
hzversushertz?