// LCD #include <LiquidCrystal.h> #include <math.h> LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2); // LCD int backLight = 13; void setup(void) { pinMode(backLight, OUTPUT); digitalWrite(backLight, HIGH); lcd.begin(16, 2); lcd.clear(); lcd.setCursor(0,0); } // double Getterm(int RawADC) { double temp; temp = log(((10240000/RawADC) - 10000)); temp = 1 / (0.001129148 + (0.000234125 * temp) + (0.0000000876741 * temp * temp * temp)); temp = temp - 273.15; return temp; } // void printTemp(void) { double temp = Getterm(analogRead(4)); // lcd.clear(); lcd.setCursor(0,0); lcd.print("Temperature is:"); lcd.setCursor(0,1); lcd.print(temp); lcd.print(" C"); } void loop(void) { printTemp(); // , delay(1000); }
Source: https://habr.com/ru/post/141691/
All Articles