Arduino Code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface
pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
#define sensor A0
#define red 6
#define green 7
float SensorInput = 0;
float Temp_Celsius = 0;
float Temp_Fahren = 0;
void setup()
{
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
pinMode(red, OUTPUT);
pinMode(green, OUTPUT);
}
void loop()
{
SensorInput = analogRead(sensor);
Temp_Celsius = SensorInput * 0.48828125;
Temp_Fahren = (Temp_Celsius * 1.8) + 32;
if (Temp_Celsius > 50)
{
digitalWrite(red, 1);
digitalWrite(green, 0);
}
else if (Temp_Celsius < 50)
{
digitalWrite(green, 1);
digitalWrite(red, 0);
}
lcd.setCursor(0, 0);
lcd.print("Celsius: ");
lcd.setCursor(10, 0);
lcd.print(Temp_Celsius);
lcd.setCursor(0, 1);
lcd.print("Fahrenheit: ");
lcd.setCursor(13, 1);
lcd.print(Temp_Celsius);
}
EECP3171 - Assignment Sem-3 (2018-19) Submission method: Individual Demonstration of Simulation on Tinkercad Demonstration Schedule: 20...