Hey Neilzero..
Ive adapted your code into my little program, but can't find out how to make it show the temperature as 26,1 as oposed to the 261 format it is in now ?!?! Im sure you have a solution, I just can't see it since i've only been into arduino programming for about 4 days now :-/
My code is at the bottom.
int heat = 451;
char heat_str[4] = " "; //reserve the string space first
itoa(heat, heat_str, 10);
lcd.printIn(heat_str);
//todo: make sure number can be notated within str length.
My code..
#include <LCD4Bit.h>
LCD4Bit lcd = LCD4Bit(2);
int temperaturePin = 2; // select the input pin for the temperature
void setup() {
lcd.init();
}
void loop() {
lcd.clear();
lcd.printIn("Vandtemperatur :");
delay(1000);
int i, val = 0;
for(i = 0; i < 20; ++i)
{
val += analogRead(temperaturePin); // read the value from the sensor
delay(50);
}
val /= 4.06; // conversion value to millivolts
if(val > 28 * 10) // temperature in deg C times 10, since we're measuring to tenths of a degree
digitalWrite(13,HIGH);
else
digitalWrite(13,LOW);
int heat = val;
char heat_str[5] = " "; //reserve the string space first
itoa(val, heat_str, 10);
lcd.cursorTo(2, 5); //line=2, x=6.
lcd.printIn(heat_str);
delay(1000);
}
Thanks... Martin