Hi.
i am try to work on a little project which reads a thermistor for temp displays the value on a lcd and now i would like to have a led to turn on if the value of Temp is = or > than 25 the code works the led in on above 25 but the led flashes on and off below 25 not sure what to do still leaning.
thanks
Chilliman
code below:-
// Project Seven - temperature and lcd
//
int a;
int del=1000; // duration between temperature readings
float temperature;
int B=3975;
float resistance;
// include the library code:
#include <LiquidCrystal.h>
int LED =8;
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(2, 3, 4, 5, 6, 7, 8);
void setup()
{
// set up the LCD's number of rows and columns:
lcd.begin(16, 2);
// Print a message to the LCD.
//lcd.print(temperature);
pinMode(LED,OUTPUT);
}
void loop()
{
a=analogRead(1);
resistance=(float)(1023-a)*10000/a;
int(temperature=1/(log(resistance/10000)/B+1/298.15)-273.15);
delay(del);
// Turn off the display:
lcd.noDisplay();
delay(100);
// Turn on the display:
lcd.display();
delay(100);
lcd.setCursor(0, 0);
lcd.print("Temp ");
lcd.print(int(temperature));
lcd.print(" C.");
}
{
// turn on led if temp over 25
if (int(temperature)>= 25) digitalWrite(LED,HIGH);
else
digitalWrite(LED,LOW);
}