0% found this document useful (0 votes)
51 views2 pages

100 Suhu Maksimal Yang Di Tampilkan

This document contains code to read temperature sensor values from an analog pin and display the temperature reading and status (LOW or HIGH) on an LCD screen. It initializes the LCD, reads the sensor value, converts it to a temperature, and displays the temperature to two decimal places on the top line of the LCD along with "C". It then displays either "LOW" or "HIGH" on the second line depending on whether the temperature is below or above 50 degrees.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views2 pages

100 Suhu Maksimal Yang Di Tampilkan

This document contains code to read temperature sensor values from an analog pin and display the temperature reading and status (LOW or HIGH) on an LCD screen. It initializes the LCD, reads the sensor value, converts it to a temperature, and displays the temperature to two decimal places on the top line of the LCD along with "C". It then displays either "LOW" or "HIGH" on the second line depending on whether the temperature is below or above 50 degrees.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

#include <LiquidCrystal.

h>
LiquidCrystal lcd(16, 17, 18, 20, 21, 22, 23); // lcd initialization
int sensorValue; // variable to read sensor value
float suhu;
void setup()
{
[Link](16, 2); // set up the LCD's
[Link]("[Link]-TEM"); // Print a message to the LCD.
[Link](0, 1);
[Link]("SENSOR SUHU LM35");
delay(20); // delay of 2 sec
[Link](); // clear the screen
}
void loop()
{
sensorValue = analogRead(0); // read sensor value from A0 pin
suhu=(float)sensorValue*100/1023; 100 = suhu maksimal yang di tampilkan
[Link](0, 0); // set cursor position at 0,0
[Link]("[Link] - TEM "); // print a message
[Link](0, 1); // set cursor position at 0,1
[Link](suhu,2); // prints the analog value Dua digit dibelakang koma
[Link](7, 1);
[Link](0xdf);
[Link]("C");
Jika suhu DIBAWAH 50 makaTulisan LOW
if (suhu<50)
{
[Link](10,1); Tulisan LOW = di kolom 10, baris ke-2
[Link]("LOW ");
}
else if (suhu>50) Jika suhu DIATAS 50 makaTulisan HIGH
{
Tulisan HIGH = di kolom 10, baris ke-2
[Link](10,1);
[Link]("HIGH");
}
}

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include <LiquidCrystal.h>
LiquidCrystal lcd(16, 17, 18, 20, 21, 22, 23); // lcd initialization
int sensorValue; // variable to read sensor value
float suhu;
void setup()
{
[Link](16, 2); // set up the LCD's

}
void loop()
{
[Link](0, 0);
[Link]("SUHU:");
sensorValue = analogRead(0); // read sensor value from A0 pin
suhu=(float)sensorValue*100/1023; Pembacaan suhu, kolom 5 baris 1
[Link](5, 0);
[Link](suhu,2); // prints the analog value Dua digit dibelakang koma
[Link](10, 0);
[Link](0xdf);
[Link]("C");
Jika suhu DIBAWAH 50 makaTulisan LOW
if (suhu<50)
{
Tulisan LOW = di kolom 7, baris ke-2
[Link](7,1);
[Link]("LOW ");
}
else if(suhu>50) Jika suhu DIATAS 50 makaTulisan HIGH
{ Tulisan HIGH = di kolom 7, baris ke-2
[Link](7,1);
[Link]("HIGH");
}
}

You might also like