Hi, newbie here. Can someone shed some light on this please. ![]()
I watched a few Utube videos and searched the forums on how to display temperature with arduino using a pot. I can’t seem to reverse the Output for the Temp instead of 0v = hot and 5v = cold, it shows the opposite.
How can I display the temps on the LCD/OLED LCD with a 0-5v Input using a Potentiometer:
0v=220c
0.16v=212c
0.31v=194c
0.47v=183c
0.62v=174c
0.78v=163c
0.94v=154c
1.09v=145c
1.25v=136c
1.40v=127c
1.56v=118c
1.72v=109c
and so on until 5v = -30c
Sorry for the terminologies I used, I really am a newbie. And for the confusing tinker cad wirings, just trying to get it done.
Here are the codes I copied from some forums and videos:
//
#include "LiquidCrystal.h"
LiquidCrystal lcd(12,11,5,4,3,2);
int sensorPin = 0;
void setup()
{
Serial.begin(9600);
lcd.begin(16,2);
}
void loop()
{
int reading = analogRead(sensorPin);
// measure the 5v with a meter for an accurate value
//In particular if your Arduino is USB powered
float voltage = reading * (5 / 1023.0);
// now print out the temperature
float temperatureC = (voltage - 0.5) * 100;
Serial.print(temperatureC);
Serial.println(" degrees C");
lcd.setCursor(0,0);
lcd.print("TEMP: ");
lcd.setCursor(7,0);
lcd.print(temperatureC);
lcd.setCursor(13,0);
lcd.print("C");
// print out the voltage
Serial.print(voltage);
Serial.println(" volts");
lcd.setCursor(0,1);
lcd.print("Volts: ");
lcd.setCursor(6,1);
lcd.print(voltage);
lcd.setCursor(11,1);
lcd.print("v");
delay(100);
}
