mirror of
https://bitbucket.org/myhomie/mycorerepository.git
synced 2025-12-06 17:51:20 +00:00
17 lines
413 B
Python
17 lines
413 B
Python
from mq import *
|
|
import sys, time
|
|
|
|
try:
|
|
print("Press CTRL+C to abort.")
|
|
|
|
mq = MQ();
|
|
while True:
|
|
perc = mq.MQPercentage()
|
|
sys.stdout.write("\r")
|
|
sys.stdout.write("\033[K")
|
|
sys.stdout.write("LPG: %g ppm, CO: %g ppm, Smoke: %g ppm" % (perc["GAS_LPG"], perc["CO"], perc["SMOKE"]))
|
|
sys.stdout.flush()
|
|
time.sleep(0.1)
|
|
|
|
except:
|
|
print("\nAbort by user") |