top of page

Temperature Logger Code
long time;
void setup() {
Serial.begin(9600); //This sets up the serial port so that the temperature can be read.
}
void loop() {
time = millis();
Serial.print(time/1000); //prints time since program started
Serial.print(" , ");
int sensorVal = analogRead(0); //Stores the value being read by the center pin.
int val=analogRead(0);//Connect LM35 on Analog 0
float temperature=(500 * val) /1024;
Serial.print(temperature); //Prints the temperature.
Serial.println();
delay(1000); // wait a second so as not to send massive amounts of data
}
bottom of page