Temperature display

I am afraid my comments on the Sparkfun website may have been a little ratty after my wasted hours of trial and error. They were very quick to respond and have now offered to ship out two new and correctly labeled boards, which was very nice of them seeing that it was just a labeling problem. The boards will come in handy as I get nearer to a final controller for the solar system.
A long way off being that the system itself does not exist yet, but I reached a small milestone in getting the temperature to display properly in degrees C and to display "Low" when under 25 and "High" when above. The next step was getting some little lights to work on the same switch and my next goal is to control a relay.
The sensor produces what it likes, the board interprets that in its way and I have to get that into something I understand. "reading0" is the boards interpretation of a number of millivolts produced by the sensor. Those have to be multiplied by 4.883 to get them back to what they were before the boards computer translated them. The sensor produces 600 millivolts at zero degrees, so that is subtracted to give the temperature. The sensor produces 10 millivolts per degree, so finally divide by ten to give something centigrade lovers can drink up. That integer value is popped into a bit of memory called "Sensor0temp".
int Sensor0temp = ((reading0 * 4.883)-600)/10
One of the stupid challenges in getting the display to work was figuring out how to display degrees properly. For the arduinauts among you here are the two lines to display just that.
First put the cursor at the right spot, then print the temperature number we just made; Then print the character for the degree sign; Then print a C
lcd.setCursor(7, 0);
lcd.print(Sensor0temp);lcd.print((char)223);lcd.print("C");
<< Home