#include <LiquidCrystal.h>
//(rs, enable, d4, d5, d6, d7)
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
int adcValues[] = { 200, 400, 500, 880, 710};
float Vref = 1.1;
int maxADC = 1023;
float slope = (1.20525 - 0.174) / (125 - (-40)); // الميل
float offset = 0.174; // الإزاحة
void setup() {
lcd.begin(16, 2);
}
void loop() {
for (int i = 0; i < 5; i++) {
int adc = adcValues[i];
float voltage = (adc * Vref / maxADC) * 1000;//mv
float temperature = (voltage / 1000 - offset) / slope;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("ADC=");
lcd.print(adc);
lcd.print(" ");
lcd.print(round(voltage));
lcd.print("mV");
lcd.setCursor(0, 1);
lcd.print("Temp=");
lcd.print(round(temperature));
lcd.print((char)223);
lcd.print("C");
delay(2000);
}
}