if True: # The serials are hexlified versions, to be more readable. dao.newSensor(b'DS18B20P', b'28cde9f505000027', exprRawToCelsiusDS) dao.newSensor(b'DS18B20P', b'289abbab05000057', exprRawToCelsiusDS) # Waterproof dao.newSensor(b'MLX90614', b'Ambient', exprRawToCelsiusMLX) dao.newSensor(b'MLX90614', b'Object', exprRawToCelsiusMLX) dao.newSensor(b'CommandeBouilleur') iface = Iface() bEnd = Value('b', False) Thread(target=workerHWIFace, args=(iface,bEnd)).start() if True: dao.newWave(sComment='Cristaux, chauffe un peu pas longtemps') # FIXME: change dao API, comment sensor with bPartNumber,bHardID... dao.commentSensor(1, 'Sur la breadboard, un peu loin de la casserole', 'Air (°C)') dao.commentSensor(2, 'Dans l\'eau, le plus loin de la résistance', 'Eau (°C)') dao.commentSensor(3, 'Sur la breadboard, près de la casserole', 'Air (°C)') dao.commentSensor(4, 'Vise le cul de la casserole', 'Eau, ext (°C)') dao.commentSensor(5, 'N/A') t0 = time.time() try: PERIOD = 10 while not bEnd.value: while time.time()-t0 < PERIOD: time.sleep(PERIOD/100) t0 += PERIOD assert time.time()-t0 < PERIOD # FIXME: think about sensorID too in newMeasure... iT = int(time.time()) # Records measures
log.write(time.ctime() + " : End of DS measurement") log.write("\nTotal time : " + str(time.time()-temps)) log.close() iface = Bulk() stop = Value('b', False) db = 'essai.db' dao = DAO(db) mesure_reussie = Value('b', False) if False: #time.sleep(15) dao.newSensor(b'SHT21', b'RH') dao.newSensor(b'SHT21', b'Temperature') dao.newWave(sComment='Premier essai avec la nouvelle BBB') dao.commentSensor(1, 'Derriere le PC', 'Air(%RH)') dao.commentSensor(2, 'Derriere le PC', 'Air(.C)') Thread(target=workerSHT, args=(iface, stop)).start() try: while True: dao.newMeasure(1, iface.shtRH) dao.newMeasure(2, iface.shtTemp) time.sleep(5) except KeyboardInterrupt: print('End of record') stop.value = True if True: #dao.newSensor(b'DS18B20', b'2864edaa050000b0') dao.newSensor(b'DS18B20', b'28ff753e651401b3')
log.write(time.ctime() + " : End of DS measurement") log.write("\nTotal time : " + str(time.time() - temps)) log.close() iface = Bulk() stop = Value('b', False) db = 'essai.db' dao = DAO(db) mesure_reussie = Value('b', False) if False: #time.sleep(15) dao.newSensor(b'SHT21', b'RH') dao.newSensor(b'SHT21', b'Temperature') dao.newWave(sComment='Premier essai avec la nouvelle BBB') dao.commentSensor(1, 'Derriere le PC', 'Air(%RH)') dao.commentSensor(2, 'Derriere le PC', 'Air(.C)') Thread(target=workerSHT, args=(iface, stop)).start() try: while True: dao.newMeasure(1, iface.shtRH) dao.newMeasure(2, iface.shtTemp) time.sleep(5) except KeyboardInterrupt: print('End of record') stop.value = True if True: #dao.newSensor(b'DS18B20', b'2864edaa050000b0') dao.newSensor(b'DS18B20', b'28ff753e651401b3')