#include const int rx=1; const int tx=2; const int tpin=3; int sample; int samplesize=5; SoftwareSerial mySerial(1,2); void setup() { mySerial.begin(9600); } void loop() { int t; t=analogRead(tpin); for (int x = 0; x < samplesize; x++) { t = t + sample; sample=analogRead(tpin); } float t = t / samplesize float tc=calcT(t); mySerial.println(tc); delay(1000); } float calcT(int data) { float B=3750; float T0=298.15; float R0=10000.0; float R1=11200.0; float rr1,t; rr1= R1 * data / (1024.0 - data); t = 1 / (log(rr1 / R0) / B + (1 / T0)); return (float)(t - 273.15); }