#include #include SoftwareSerial mySerial(0,2); // RX, TX from point of view of chip #define R25 10000 // Resistência do NTC a 25°C #define Beta 3750 void setup() { mySerial.begin(9600); } void loop() { int Vref = analogRead(2); // Tensão de referência int Vntc = analogRead(3); // Tensão sobre o NTC double Intc = 2*Vref - Vntc; // Corrente que flui pelo NTC Intc /= 10000; double Rntc = Vntc / Intc; // Cálculo da resistência do NTC double Tk = 1 / ((log(Rntc / R25) / Beta) + (1 / 298.15)); // Temperatura em Kelvin double Tc = Tk - 273.15; // Temperatura em °C mySerial.println(Tc); delay(1000); }