Skip to content

Instantly share code, notes, and snippets.

@ThePenguin1140
Last active November 23, 2015 21:31
Show Gist options
  • Save ThePenguin1140/d5f541bd4f907a7d9109 to your computer and use it in GitHub Desktop.
Save ThePenguin1140/d5f541bd4f907a7d9109 to your computer and use it in GitHub Desktop.
#include <math.h>
double celsius = 0;
double Thermistor(int RawADC) {
double Temp;
Temp = log(10000.0*((1024.0/RawADC-1)));
Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );
return Temp;
}
void setup() {
Serial.begin(9600);
}
void loop() {
celsius = Thermistor(analogRead(1)); // display celsius
Serial.print(celsius);
Serial.println("*C");
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment