def main(): preVal = "-----" pm1 = preVal pm2_5 = preVal pm10 = preVal temperature = preVal humidity = preVal pressure = preVal maxTemperature = preVal printEmpty() printIntro() time.sleep(4) printEmpty() while True: OPCN3, valid = mL.readJSONLatestAll("OPCN3") if (valid): pm1 = str(OPCN3['pm1']).rjust(7, " ") pm2_5 = str(OPCN3['pm2_5']).rjust(7, " ") pm10 = str(OPCN3['pm10']).rjust(7, " ") # getPMDecimals(pm10) BME280, valid = mL.readJSONLatestAll("BME280") if (valid): # print(BME280) temperature = BME280['temperature'] humidity = BME280['humidity'] pressure = BME280['pressure'] FLIR001, valid = mL.readJSONLatestAll("FLIR001") if (valid): # print(FLIR001) maxTemperature = str(FLIR001['maxTemperature']) minTemperature = str(FLIR001['minTemperature']) printData(pm1, pm2_5, pm10, temperature, pressure, humidity, maxTemperature, minTemperature)
os.system("vodisp bitmap mints5.bmp") time.sleep(2) os.system("vodisp bitmap mints4.bmp") time.sleep(2) os.system("vodisp bitmap mints3.bmp") time.sleep(2) showIntro() while (True): try: imgBase = Image.new('RGB', (800, 480), color=(0, 0, 0)) OPCN3, validOPCN3 = mL.readJSONLatestAll("OPCN3") BME280, validBME280 = mL.readJSONLatestAll("BME280") LIBRAD, validLIBRAD = mL.readJSONLatestAll("LIBRAD") APDS9002, validAPDS9002 = mL.readJSONLatestAll("APDS9002") TB108L, validTB108L = mL.readJSONLatestAll("TB108L") pm1 = str(OPCN3['pm1']).rjust(7, " ") pm2_5 = str(OPCN3['pm2_5']).rjust(7, " ") pm10 = str(OPCN3['pm10']).rjust(7, " ") ozone = str(TB108L['ozone']).rjust(7, " ") temperature = BME280['temperature'] pressure = float(BME280['pressure']) / 100 humidity = BME280['humidity'] luminance = APDS9002['luminance']
time.sleep(5) os.system("vodisp bitmap mints02.bmp") time.sleep(5) os.system("vodisp bitmap mints05.bmp") time.sleep(5) os.system("vodisp bitmap mints04.bmp") time.sleep(5) os.system("vodisp bitmap mints03.bmp") time.sleep(5) # showIntro() while (True): OPCN3, validOPCN3 = mL.readJSONLatestAll("OPCN3") BME280, validBME280 = mL.readJSONLatestAll("BME280") pm1 = str(OPCN3['pm1']).rjust(7, " ") pm2_5 = str(OPCN3['pm2_5']).rjust(7, " ") pm10 = str(OPCN3['pm10']).rjust(7, " ") temperature = BME280['temperature'] pressure = float(BME280['pressure']) / 100 humidity = BME280['humidity'] lastUpdate = str(OPCN3['dateTime']) d = ImageDraw.Draw(imgBase) d.text((1, 1), " ") d.text((1, 5), " MINTS (Multi-Scale Integrated Sensing and Simulation)", font=fnt, fill="GREEN") d.text(