1. Kondisi[kembali]
Bila suhu yang terbaca pada LCD menunjukkan suhu kisaran 50-55 derajat Celcius, maka motor berputar lambat, jika kisaran 60-65 derajat Celcius motor berputar sedang.
2. Rangkaian Simulasi[kembali]
3. Flowchart[kembali]
4. Listing Program[kembali]
#include <LiquidCrystal.h>
#define LM35 A0
LiquidCrystal lcd(2,3,4,5,6,7);
int nilaiSuhu, motor;
int output,nilai;
void setup()
{
motor = 9;
pinMode (A0,INPUT);
pinMode (motor,OUTPUT);
lcd.begin(16,2);
}
void loop()
{
nilaiSuhu = ((5 * analogRead (LM35)*100.00) /1024);
lcd.clear();
lcd.print("LM35 Sensor Suhu");
lcd.setCursor(0,1);
lcd.print(nilaiSuhu);
delay(100);
if (nilaiSuhu >= 50 && nilaiSuhu <=55)
{
analogWrite(motor,125);
}
else if(nilaiSuhu >=60 && nilaiSuhu<=65)
{
analogWrite(motor,255);
}
else
{
nilai =0;
analogWrite(motor,output);
}
}
5. Video[kembali]
6. Link Download[kembali]
Tidak ada komentar:
Posting Komentar