i am programming in python on a Raspberry Pi 3 and i have the following problem:
Raspberry has a temperature sensor and its data is printed on terminal by a simple module
#!/usr/bin/python
import sys
import Adafruit_DHT
flag = True
while flag:
humidity, temperature = Adafruit_DHT.read_retry(11, 4)
print 'Temp: {0:0.1f} C Humidity: {1:0.1f} %'.format(temperature, humidity)
i need to stop the cycle from another module, setting the flag to a False value. How can i do this? I need to have this possibility even from a button on an android application...a nonblocking queue would be the best fit, but i haven't found nothing similar on Pika documentation.
Anyone could give me some help? Thanks in advance.