Worksheet 3.1
Worksheet 3.1
Pick the temperature value randomly: range of temp is 0 degree Celsius to 50 degrees Celsius.
a) Turn on the Red light and print “COLD” in the 2nd Row on the LCD and the temp value “Temp is = ”
in the Ist row on LCD and the rest Leds are in off condition.
b) Turn on the Green light and print “HOT” in the 2nd Row on the LCD and the temp value “Temp is = ”
in the Ist row on LCD and the rest Leds are in off condition.
c) Turn on the Yellow light and print “MODERATE” in the 2nd Row on the LCD and the temp value
“Temp is = ” in Ist row on LCD and the rest Leds are in off condition.
Note:
Hardware Requirements: Arduino Uno, Breadboard, Resistor(1k Ohm, 220 Ohm), Temperature
Sensor, LCD(16x2), LEDs( Red, Green, Yellow)
3. Circuit Diagram(TinkerCad):
1. Coding:
//21MCA3001_HUMANSHI
#include <LiquidCrystal.h>
int seconds = 0;
int red =6;
int yellow=8;
int green=9;
int temp= A0;
LiquidCrystal lcd_1(12, 11, 5, 4, 3, 2);
void setup()
{
lcd_1.begin(16, 2);
lcd_1.print("hello world!");
pinMode(red, OUTPUT); // Set red LED pin as output
pinMode(green, OUTPUT); // Set green LED pin as output
pinMode(yellow, OUTPUT); // Set yellow LED pin as output
pinMode(temp, INPUT);
void loop()
{
int sensorValue = analogRead(temp); // Read the analog value from TMP35
float temperature = (sensorValue * 5.0 / 1024 - 0.5) * 100; // Convert analog value to
temperature in Celsius
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting
// begins with 0):
lcd_1.setCursor(0, 0);
// print the number of seconds since reset:
lcd_1.print("temp is");
lcd_1.print(temperature);
delay(1000);
}
5. Learning outcomes (What I have learnt):
1.
Evaluation Grid (To be created as per the SOP and Assessment guidelines by the faculty):