I have this program but the readings i get are not in degrees celsius. What conversion do i have to put in to convert the temperature i get from the thermistor to degrees celsius
/*This program was borrowed from makezine.com and edited by Patrick B. It is designed to protect a plant and inform the user
when the plant requires attention by shining a specific color from the rgb led as well as displaying the data on a lcd screen.*/
// I am using the LCD Library in this program
#include <LiquidCrystal.h>
//setting up the pins to which the different sensors get connected to
int moistPin = 2;
int tempPin = 0;
int lightPin = 1;
//initialize variables to store readings from sensors
int moistVal = 0;
int tempVal = 0;
int lightVal = 0;
//setting up pins for the rgb led
int redPin = 6;
int greenPin = 5;
int bluePin = 4;
// setting up the pins to which the lcd is connected to
LiquidCrystal lcd(7,8,9,10,11,12);
void setup()
{
//displaying the data on a serial monitor
Serial.begin(9600);
//setting the LED pins to output mode
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
//setting the LED pins to on
digitalWrite(redPin, HIGH);
digitalWrite(greenPin, HIGH);
digitalWrite(bluePin, HIGH);
// setting up the LCD's number of columns and rows:
lcd.begin(16, 2);
}
void loop()
{
moistVal = analogRead(moistPin);
//display moisture reading on lcd
lcd.clear();
lcd.print("moisture ");
lcd.print(moistVal);
//turn on LED to blue, others off if moisture pins are touching together
if (moistVal > 1000)
{
blue();
}
else
{
off();
}
//delay 4 seconds (wait)
delay(4000);
//display moisture reading on lcd
tempVal = analogRead(tempPin);
lcd.clear();
lcd.print("temperature ");
lcd.print(tempVal);
if (tempVal > 148)
{
red();
}
else
{
off();
}
delay(4000);
lightVal = analogRead(lightPin);
//display the moisture reading from soil probes on lcd
lcd.clear();
lcd.print("light ");
lcd.print(lightVal);
// if light sensor reads 600 or brighter turn on the green colour of the rgb led
if (lightVal > 600)
{
green();
}
else
{
off();
}
delay(4000);
}
void blue()
{
digitalWrite(redPin, HIGH);
digitalWrite(greenPin, HIGH);
digitalWrite(bluePin, LOW);
}
void red()
{
digitalWrite(redPin, LOW);
digitalWrite(greenPin, HIGH);
digitalWrite(bluePin, HIGH);
}
void green()
{
digitalWrite(redPin, HIGH);
digitalWrite(greenPin, LOW);
digitalWrite(bluePin, HIGH);
}
void off()
{
digitalWrite(redPin, HIGH);
digitalWrite(greenPin, HIGH);
digitalWrite(bluePin, HIGH);
}
void on()
{
digitalWrite(redPin, LOW);
digitalWrite(greenPin, LOW);
digitalWrite(bluePin, LOW);
}