Code :
//Temperature Sensor Interfacing with arduino mega2560
//Author : Arslan Ali
//declare variables
float tempC;
float tempF;
void setup() {
Serial.begin(9600);
}
void loop()
{
tempC = analogRead(A0); //Read the analog value from the Lm35 sensor
tempC = (5.0 * tempC * 100 )/1024.0; //convert the analog data to temperature (Dout=vin*step size)... and step size=vref/resolution)
tempF = ((tempC*9)/5) + 32; //convert celcius to farenheit
Serial.print(tempC, 1);
Serial.print(",\t");
Serial.println(tempF, 1);
delay(1000);
}
//Temperature Sensor Interfacing with arduino mega2560
//Author : Arslan Ali
//declare variables
float tempC;
float tempF;
void setup() {
Serial.begin(9600);
}
void loop()
{
tempC = analogRead(A0); //Read the analog value from the Lm35 sensor
tempC = (5.0 * tempC * 100 )/1024.0; //convert the analog data to temperature (Dout=vin*step size)... and step size=vref/resolution)
tempF = ((tempC*9)/5) + 32; //convert celcius to farenheit
Serial.print(tempC, 1);
Serial.print(",\t");
Serial.println(tempF, 1);
delay(1000);
}