TP modul 2
Bila suhu yang terbaca pada lcd menunnjukkan suhu kisaran 25-30 derajat celsius maka 2 led berwarna merah dan hijau akan hidup
#include <LiquidCrystal.h>
#define LM35 A0
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
int nilaiSuhu;
int i=0;
char C;
void setup()
{
pinMode(A0, INPUT);
pinMode(2, OUTPUT);
pinMode(5, OUTPUT);
lcd.begin(16, 2);
}
void loop()
{
if (nilaiSuhu>=25 && nilaiSuhu<=30)
{
digitalWrite(2, HIGH);
digitalWrite(5, HIGH);
}
else
{
digitalWrite(2, LOW);
digitalWrite(5, LOW);
}
nilaiSuhu = ((5*(analogRead(LM35))*100.00)/1024);
for (i=0;i<16;i++)
{
lcd.setCursor(i, 0);
lcd.print("SENSOR SUHU");
delay(80);
lcd.clear();
lcd.setCursor(0, 1);
lcd.print(nilaiSuhu);
lcd.setCursor(3, 1);
lcd.print("C");
delay(80);
}
}
#define LM35 A0
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
int nilaiSuhu;
int i=0;
char C;
void setup()
{
pinMode(A0, INPUT);
pinMode(2, OUTPUT);
pinMode(5, OUTPUT);
lcd.begin(16, 2);
}
void loop()
{
if (nilaiSuhu>=25 && nilaiSuhu<=30)
{
digitalWrite(2, HIGH);
digitalWrite(5, HIGH);
}
else
{
digitalWrite(2, LOW);
digitalWrite(5, LOW);
}
nilaiSuhu = ((5*(analogRead(LM35))*100.00)/1024);
for (i=0;i<16;i++)
{
lcd.setCursor(i, 0);
lcd.print("SENSOR SUHU");
delay(80);
lcd.clear();
lcd.setCursor(0, 1);
lcd.print(nilaiSuhu);
lcd.setCursor(3, 1);
lcd.print("C");
delay(80);
}
}
Download Rangkaian Simulasi [ DOWNLOAD]
Download Video [DOWNLOAD]
Download HTML [DOWNLOAD]
Tidak ada komentar:
Posting Komentar