ARDUINO UNO AND LM35
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
int val;
int tempPin = 1;
void setup()
{
Serial.begin(9600);
lcd.begin(16, 2);
pinMode(12, OUTPUT);
}
void loop()
{
val = analogRead(tempPin);
float mv = ( val/1024.0)*5000;
float cel = mv/10;
Serial.print("TEMPRATURE = ");
Serial.print(cel);
Serial.print("°C");
Serial.println();
delay(1000);
lcd.setCursor(4, 1);
lcd.print(cel);
lcd.setCursor(9, 1);
lcd.print((char)223);
lcd.print("C");
if(cel >= 38)
{
digitalWrite(12, HIGH);
}
else
{
pinMode(12, LOW);
}
}
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
int val;
int tempPin = 1;
void setup()
{
Serial.begin(9600);
lcd.begin(16, 2);
pinMode(12, OUTPUT);
}
void loop()
{
val = analogRead(tempPin);
float mv = ( val/1024.0)*5000;
float cel = mv/10;
Serial.print("TEMPRATURE = ");
Serial.print(cel);
Serial.print("°C");
Serial.println();
delay(1000);
lcd.setCursor(4, 1);
lcd.print(cel);
lcd.setCursor(9, 1);
lcd.print((char)223);
lcd.print("C");
if(cel >= 38)
{
digitalWrite(12, HIGH);
}
else
{
pinMode(12, LOW);
}
}
Comments
Post a Comment