#include <math.h>
int analog = 0; //analog pin raw value
//int V_0 = 3276; //cirquit voltage [mV]
//double V_R0 = 1; //initial value of voltage devider[mV]
//int circuit_R0 = 9800; //resistance of voltage divider[ohm]
//int thermo_B = 3380; //B parameter of thermistor
//int thermo_R0 = 10000; //reference resistance of thermistor [ohm]
//int thermo_T0 = 298; //reference tempereture of thermistor[K]
//double thermo_R = 1; //initial resistance of thermistor[ohm]
//double temp = 25.00; //initial value of measured temperature[degC]
void setup () {
Serial.println("Waiting for connections...");
pinMode(34, INPUT); // thermistor
Serial.begin(9600); /* 9600 bps connect serial */
Serial.println("READ_START");
}
void loop () {
analog = analogRead(34);
//analog = map(((analogRead(34) - 20) * 3.04), 0, 1023, -40, 125); //voltage divider calculation
//thermo_R = V_0 / V_R0 * circuit_R0 - circuit_R0; //thermistor resistance calculation
Serial.println( analog);
//Serial.println( V_R0);
//Serial.println( thermo_R); //printing thermistor resistance
//temp = (1000 / (1 / (0.001 * thermo_T0) + log(thermo_R / thermo_R0) * 1000 / thermo_B) - 273); //temparature calculation
//Serial.println(temp, 1); //printing temparature
delay(5000); // waiting for 0.1s
}