0% found this document useful (0 votes)
21 views1 page

Script Program Kipas Angin Otomatis

The document contains code to read temperature from an LM35 sensor and display it on an LCD while controlling a motor based on the temperature threshold of 30 degrees Celsius.

Uploaded by

Rizky Aditya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views1 page

Script Program Kipas Angin Otomatis

The document contains code to read temperature from an LM35 sensor and display it on an LCD while controlling a motor based on the temperature threshold of 30 degrees Celsius.

Uploaded by

Rizky Aditya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

#include <LiquidCrystal.

h>
LiquidCrystal lcd(7,6,5,4,3,2);
float tempC = 13;
int LM35 = A0, hasil;
char a[16];
int motor = 1;

 
void setup(){
lcd.begin(16,2);
lcd.setCursor(0,0);
lcd.print("SUHU RUANGAN");
pinMode(motor,OUTPUT);
}

void loop(){
tempC = analogRead(LM35);
tempC = (5.0*tempC*100.0)/1024.0;
hasil = (int)tempC;

lcd.setCursor(0,1);
sprintf(a,"SUHU=%d",hasil);
lcd.print(a);
lcd.print((char)223);
lcd.print("C");

if(hasil>30){
digitalWrite(motor,HIGH);
}

if(hasil<30){
digitalWrite(motor,LOW);
}
}

You might also like