ALguien por favor podria aydarme a modificar este codigo :
/*
Arduino thermistor example software
Tutorial: http://www.hacktronics.com/Tutorials/arduino-thermistor-tutorial
Copyright (c) 2010 Mark McComb, hacktronics LLC
License: The MIT License – Open Source Initiative (Go crazy)
*/
#include <LiquidCrystal.h>
#include <math.h>
/*
See tutorial for Thermistor connections
LCD Connections:
rs (LCD pin 4) to Arduino pin 12
rw (LCD pin 5) to Arduino pin 11
enable (LCD pin 6) to Arduino pin 10
LCD pin 15 to Arduino pin 13
LCD pins d4, d5, d6, d7 to Arduino pins 5, 4, 3, 2
*/
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
int backLight = 13; // pin 13 will control the backlight
void setup(void) {
pinMode(backLight, OUTPUT);
digitalWrite(backLight, HIGH); // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off.
lcd.begin(20, 4); // rows, columns. use 16,2 for a 16x2 LCD, etc.
lcd.clear(); // start with a blank screen
lcd.setCursor(0,0); // set cursor to column 0, row 0
}
double Thermister(int RawADC) {
double Temp;
// See Thermistor - Wikipedia for explanation of formula
Temp = log(((10240000/RawADC) - 10000));
Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
Temp = Temp - 273.15; // Convert Kelvin to Celcius
return Temp;
}
void printTemp(void) {
double fTemp;
double temp = Thermister(analogRead(0)); // Read sensor
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Temperature is:");
lcd.setCursor(0,1);
lcd.print(temp);
lcd.print(" C / ");
fTemp = (temp * 1.8) + 32.0; // Convert to USA
lcd.print(fTemp);
lcd.print(" F");
if (fTemp > 68 && fTemp < 78) {
lcd.setCursor(0,3);
lcd.print("Very comfortable");
}
}
void loop(void) {
printTemp();
delay(1000);
}
Lo que quiero agregar es que cuando la variable Temp llegue al valor 28 me de una salida 5v y en caso contrario lo mantenga apagado.
Intente con el comando if pero no me funciona y no se que estoy haciendo mal...
De antemano gracias