Added T, RH readout

This commit is contained in:
Duke NUCem
2021-09-09 18:11:11 +02:00
parent 7b0ad1fd65
commit 0837de9703
3 changed files with 50 additions and 36 deletions

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env python3
from time import sleep
import minimalmodbus
import serial
@@ -14,5 +15,11 @@ instrument.mode = minimalmodbus.MODE_RTU # rtu or ascii mode
instrument.clear_buffers_before_each_transaction = True
# read
T = 0
RH = T
CO2 = instrument.read_register(9, 1, functioncode=4) * 10
print(CO2)
sleep(0.1)
T = instrument.read_register(10, 1, functioncode=4)
sleep(0.1)
RH = instrument.read_register(11, 1, functioncode=4) * 10
print(f'CO2: {CO2} ppm\t\tT: {T} deg C\t\tRH: {RH} %')