sábado, 14 de noviembre de 2015

Control de temperatura con rangos usando LCD y LM35


/*
  LiquidCrystal Library - programa de ejemplo
 Demonstramos el uso de un display 16x2 LCD display.  
 The LiquidCrystal library trabaja con todos los displays conpatibles con
 Hitachi HD44780 driver. lo importante es verificar que tenga 16 pines

 
 El circuito:
 * LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD R/W pin to ground
 * LCD VSS pin to ground
 * LCD VCC pin to 5V
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)

 
 */

// include the library code:
#include 



int volt;
float vreal,temp;


// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.   
  //lcd.print("Arte Mecatronica!!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  

  volt=analogRead(A0);              // wait for a second
  vreal=volt*0.0048828125;

  lcd.setCursor(5, 1);
  // print the number of seconds since reset:
  //lcd.print(millis() / 1000);
  
  temp=vreal*100;
  lcd.print(temp);
  lcd.print(" grados ");
  
  if(temp>26 && temp<30)
  {
    lcd.setCursor(5, 0);
    lcd.print("normal!!");
  }
  if(temp>30 && temp<33)
  {
    lcd.setCursor(5, 0);
    lcd.print("Alerta!");
  }
  if(temp>33 && temp<36)
  {
    lcd.setCursor(5, 0);
    lcd.print("Critico");
  }
  
  
  delay(100);

}

No hay comentarios:

Publicar un comentario

Popular Posts

Conoce Manizales !!

La intranet de Manizales