1. Kondisi [kembali]
Bila suhu yang terbaca pada lcd menunnjukkan suhu kisaran 30-35 derajat celsius maka motor berputar lambat, jika kisaran 36-40 motor berputar sedang dan jika 41-45 motor berputar cepat
2. Hardware [kembali]
Gambar 1. LM35
Gambar 2. LCD 2 x 16
4. Listing Program [kembali]
#include <LiquidCrystal.h>
#define LM35 A5
LiquidCrystal lcd(0,1,2,3,4,5,6);
int nilaiSuhu ;
void setup()
{
pinMode(A5,INPUT);
lcd.begin(16,2);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
}
void loop()
{
nilaiSuhu=analogRead(LM35)*5.00*100.00/1023.00;
lcd.clear();
lcd.setCursor(0,0);
lcd.print("LM35 Sensor Suhu");
lcd.setCursor(7,1);
lcd.print(nilaiSuhu);
delay (100);
if ((nilaiSuhu >=30) && (nilaiSuhu <=35))
{
analogWrite(9,0);
analogWrite(10,50);
}
else if((nilaiSuhu >=36)&&(nilaiSuhu <=40))
{
analogWrite(9,0);
analogWrite(10,75);
}
else if((nilaiSuhu>=41)&&(nilaiSuhu <=45))
{
analogWrite(9,0);
analogWrite(10,100);
}
else
{
analogWrite(9,LOW);
analogWrite(10,LOW);
}
}
5. Video Simulasi [kembali]
#include <LiquidCrystal.h>
#define LM35 A5
LiquidCrystal lcd(0,1,2,3,4,5,6);
int nilaiSuhu ;
void setup()
{
pinMode(A5,INPUT);
lcd.begin(16,2);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
}
void loop()
{
nilaiSuhu=analogRead(LM35)*5.00*100.00/1023.00;
lcd.clear();
lcd.setCursor(0,0);
lcd.print("LM35 Sensor Suhu");
lcd.setCursor(7,1);
lcd.print(nilaiSuhu);
delay (100);
if ((nilaiSuhu >=30) && (nilaiSuhu <=35))
{
analogWrite(9,0);
analogWrite(10,50);
}
else if((nilaiSuhu >=36)&&(nilaiSuhu <=40))
{
analogWrite(9,0);
analogWrite(10,75);
}
else if((nilaiSuhu>=41)&&(nilaiSuhu <=45))
{
analogWrite(9,0);
analogWrite(10,100);
}
else
{
analogWrite(9,LOW);
analogWrite(10,LOW);
}
}
5. Video Simulasi [kembali]
Download Rangkaian di sini
Download Video disini
Download listing program disini
Download HTML disini
Download Video disini
Download listing program disini
Download HTML disini
Tidak ada komentar:
Posting Komentar