let's suppose I have two functions:
Code: Select all
def getTemperature():
# prints a temperature every minute
def turnOnLED():
# turns on a LED for 10min then turns it off- prints the temperature every minute independently of the LED's state
- turns on the LED for 10min if the temperature crosses a threshold, say 30°C.
A program like
Code: Select all
while True:
getTemperature()
if getTemperature() > 30:
turnOnLED()I should certainly use multiprocessing or threading, but I'm too much of a noob to figure out how to write the code...Could someone help me?
Thanks in advance.