Compare commits
No commits in common. "12753d93fbd63ab4d4d8b8ffbd94cd55cf0c9c90" and "f481e4de3806ea62c67c4f004ba4e59f41b07f74" have entirely different histories.
12753d93fb
...
f481e4de38
|
@ -1,5 +1,4 @@
|
||||||
import math
|
import math
|
||||||
import time
|
|
||||||
from cs1237 import CS1237
|
from cs1237 import CS1237
|
||||||
from machine import Pin
|
from machine import Pin
|
||||||
|
|
||||||
|
@ -11,7 +10,7 @@ ADC_RATE = 40
|
||||||
cs1237 = CS1237(clock, data)
|
cs1237 = CS1237(clock, data)
|
||||||
cs1237.config(gain=1, rate=ADC_RATE)
|
cs1237.config(gain=1, rate=ADC_RATE)
|
||||||
|
|
||||||
cs1237.get_config()
|
print(repr(cs1237.get_config()))
|
||||||
|
|
||||||
THERMISTOR_BETA = 3950.0
|
THERMISTOR_BETA = 3950.0
|
||||||
THERMISTOR_R25 = 10e3
|
THERMISTOR_R25 = 10e3
|
||||||
|
@ -23,7 +22,6 @@ FILTER_RC = 1
|
||||||
FILTER_A = 1 / ADC_RATE / (FILTER_RC / 1 / ADC_RATE)
|
FILTER_A = 1 / ADC_RATE / (FILTER_RC / 1 / ADC_RATE)
|
||||||
|
|
||||||
temperature_filtered = 25
|
temperature_filtered = 25
|
||||||
last_report = time.ticks_ms()
|
|
||||||
while True:
|
while True:
|
||||||
raw_value = cs1237.read()
|
raw_value = cs1237.read()
|
||||||
value = float(raw_value) / (2**24 - 1)
|
value = float(raw_value) / (2**24 - 1)
|
||||||
|
@ -39,8 +37,4 @@ while True:
|
||||||
temperature_filtered * (1 - FILTER_A) + temperature * FILTER_A
|
temperature_filtered * (1 - FILTER_A) + temperature * FILTER_A
|
||||||
)
|
)
|
||||||
|
|
||||||
now = time.ticks_ms()
|
print(temperature_filtered)
|
||||||
elapsed = now - last_report
|
|
||||||
if elapsed >= 200 or elapsed < 0:
|
|
||||||
print(f"{temperature_filtered:.6f}")
|
|
||||||
last_report = now
|
|
|
@ -1 +0,0 @@
|
||||||
import temperature_monitor
|
|
Loading…
Reference in a new issue