Hello, I am building a adjustable thermostat and wanted to be able to input the max and min temperature from the serial monitor. What I am trying to do is once the monitor is started you are prompted to put in the Max temperature which is stored as MaxC and displayed on the LCD. Then you are prompted for the MinC which is stored and displayed on the LCD. I am not much of a programmer so am having some trouble getting this to work. Here is what I have so far but its not working:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
{
// initialize serial communication:
Serial.begin(9600);
// set up the LCD's number of rows and columns:
lcd.begin(20, 4);
delay(400);
}
void loop() // run over and over again
{
//input max temp from serial
Serial.print("Max Temp?");
if (Serial.available() > 0)
int MaxC = Serial.read();
// print out the max temp
lcd.setCursor(0, 0);
delay(200);
lcd.print(MaxC); lcd.print(" Max C");
//input min temp from serial
Serial.print("Min Temp?");
if (Serial.available() > 0)
int MinC = Serial.read();
// print out the max temp
lcd.setCursor(0, 9);
delay(200);
lcd.print(MinC); lcd.print(" Min C");
delay(1000); //waiting a second
}