Greetings,
Existing code from lm35 temp sensor...My question is which part of the code can I use for an 'if' statement? ie: Is 'temperatureF' an actual variable (or can I define it at the begining and == it...) or is 'temperature F' only human language and I need to use the math part?
And on a related note...all of a sudden my serial started giving me 3 digit returns of the lm35??? I had my nano breadboarded correctly and was getting normal returns but unplugged it and did some stuff but DIDNT CHANGE A THING to the program or the hardware but started getting three hundered degrees or whatever...
Any help on either question would be great,
LLOYD
// Define the analog pin, the LM35's Vout pin is connected to
#define sensorPin A0
void setup() {
// Begin serial communication at 9600 baud rate
Serial.begin(9600);
}
void loop() {
// Get the voltage reading from the LM35
int reading = analogRead(sensorPin);
// Convert that reading into voltage
float voltage = reading * (5.0 / 1024.0);
// Convert the voltage into the temperature in Celsius
float temperatureC = voltage * 100;
// Print the temperature in Celsius
Serial.print("Temperature: ");
Serial.print(temperatureC);
Serial.print("\xC2\xB0"); // shows degree symbol
Serial.print("C | ");
// Print the temperature in Fahrenheit
float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
Serial.print(temperatureF);
Serial.print("\xC2\xB0"); // shows degree symbol
Serial.println("F");
delay(1000); // wait a second between readings
}