#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
int adc_values[] = {200, 400, 500, 880, 710};
float Vref = 1.1;
int maxADC = 1023;
float slope = 0.5;
float offset = 25;
void setup() {
Serial.begin(115200);
lcd.begin(16, 2);
}
void loop() {
for (int i = 0; i < 5; i++) {
int adc = adc_values[i];
float voltage = (adc * Vref / maxADC) * 1000;
float temperature = (slope * voltage) + offset;
lcd.clear();
lcd.setCursor(0,0)
lcd.print("ADC=");
lcd.print(adc);
lcd.print(" ");
lcd.print(voltage, 0);
lcd.print("mV");
// Move to second row
lcd.setCursor(0, 1);
lcd.print("temp=");
lcd.print(temperature, 1);
lcd.print((char)223);
lcd.print("C");
delay(2000);
}
}