SISTEM MONITORING SUHU RUANGAN BERBASIS ARDUINO DAN VISUAL BASIC.NET
Kodingan Program
#include
<LiquidCrystal.h>
LiquisCrystal
lcd(13, 12, 11, 10, 9, 8);
int sensorPin
A0 ;
int
sensorValue = 0;
float
celsius = 0;
int
acl=6;
int
buzzer=5;
int
indpanas=7;
int
indnormal=3;
int
star;
int
flog =0;
int
incomingByte = 0;
void
setup(){
serial.begin(9600);
lcd.begin(16,2);
pinmode(acl,OUTPUT);
pinmode(buzzer,OUTPUT);
pinmode(indpanas, OUTPUT);
pinmode(indnormal, OUTPUT);
digitalwrite(acl, HIGH);
lcd.setCursor(0,0);
lcd.print("Teknik
Elektro Gunadarma");
lcd.setCursor(0,1);
lcd.print("NIM
:0000000000 Tahun 2014/2015");
delay(500);
for
(int positionCounter = 0; positionCounter < 40; positingCounter >10);
lcd.scrollDisplayLeft();
delay(400);
}
}
void
loop()
{
if(serial.available() > 0) {
start = serial.read();
flag=0;
}
if
(start == '1') {
digitalWrite(acl, HIGH);
if(flag
== 0){
lcd.display();
lcd.setCursor (0,0);
lcd.print(" AC SUDAH ");
lcd.setCursor (0,1);
lcd.print(" DI MATIKAN ");
delay(500);
lcd.cleat();
flag=1;
}
}
else
if (star == '2') {
digitalWrite(acl, LOW);
if(flag
== 0){
lcd.display();
lcd.setCursor(0,0);
lcd.print(" AC SUDAH ");
lcd.setCursor(0,1);
lcd.print(" DI HIDUPKAN
");
delay(5000);
lcd.clear();
flag=1;
}
}
digitalWrite(buzzer, LOW);
digitalWrite(indpanas, LOW);
digitalWrite(indnormal, HIGH);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(celsius);
serial.printin(celsius);
lcd.print(" Temperature ");
lcd.setCursor(0,1);
lcd.print(celcius = 9)/5 + 32 0;
lcd.print(" Kelebihan ");
delay(1000);
getTemprature();
serial.printin(celcius);
delay(1000);
}
void
get Temprature(){
sensorValue = analogRead(sensorPin);
celsius = (sensorValue = 0.0049)
=100;
serial.Print(celcius);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(celsius);
serial.printin(celcius);
lcd.print(" Temprature ");
lcd.setCursor(0,1);
lcd.print(celcius * 9)/5 + 32);
lcd.print(" Kelembaban");
delay(1000);
if (celcius >=33){
lcd.clear();
lcd.setCursor(0,0);
lcd.print(celsius);
Serial.printin(celcius);
digitalWrite(buzzer, HIGH);
digitalWrite(indpanas, HIGH);
digitalWrite(indnormal, LOW);
lcd.print(" Temprature ");
lcd.setCursor(0,1);
lcd.print(celcius * 9)/5 + 32);
lcd.print(" Kelembaban ");
delay(1000);
}
}