// Forum: https://forum.arduino.cc/t/liquidcrystal-lcd-not-working/1291035
// This Wokwi project: https://wokwi.com/projects/406020115560096769
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int sensorPin = A0;
void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
pinMode(6, INPUT);
lcd.print("TEST");
lcd.setCursor(0, 1);
lcd.print("TEST2");
}
void loop() {
int sensorVal = analogRead(sensorPin);
Serial.print("Sensor: ");
Serial.print(sensorVal);
float voltage = (sensorVal / 1024.0 * 5.0);
Serial.print(", Volt: ");
Serial.print(voltage);
Serial.print(", °C: ");
float temperature = (voltage - 0.5) * 100;
Serial.println(temperature);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(temperature);
lcd.setCursor(0, 1);
lcd.print(voltage);
delay(1000);
}