From 0bd5fb31657f9f94ec811664db45071e26f41258 Mon Sep 17 00:00:00 2001 From: Beluzsar Peter Date: Mon, 21 Sep 2026 18:20:26 +0200 Subject: [PATCH] write resistance calculation --- main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 1e2bda8..7e5eccb 100644 --- a/main.cpp +++ b/main.cpp @@ -101,7 +101,11 @@ class PID { int measureTemp() { //adc_select_input(thermistor_pin); - //uint16_t result = adc_read(); + uint16_t result = adc_read(); + uint16_t v_slash_vin = 2<<15 / result; + uint16_t r = v_slash_vin * voltage_devider_resistance / (1 / (1-v_slash_vin)); + + int T = 1/(1/thermistor_beta * log(r/thermistor_resistance) + 1/thermistor_ref_temp); this->temp = 10;