-1

I have the following code to record temperature in a place and print the data but i want it to wait 1 second in between measurements. How can i do this? (C++ arduino Uno)

int sensePin = A0; //TMP36 is plugged into pin A0
int sensorInput; //used to store sensor input
double temp; //used to store temperature once converted to degrees Celcius

void setup()//Setup code that defines anything that needs to be defined
{
  Serial.begin(9600); //default start is 9600 baud on the serial monitor
}

void loop()//Main loop code where everything is executed
{
  sensorInput = analogRead(A0); //this commands the arduino to read the sensor (TMP36) and store the data
  temp = (double)sensorInput / 1024; //this will find the percentage of the input reading
  temp = temp * 5; //since I used arduino's built-in 5V supply , multiply by 5 to get voltage
  temp = temp - 0.5; //subtracts the offset
  temp = temp * 100; //multiply by 100 to convert to degrees

  Serial.print("Current Temperature: ");//this means that the converted temperature will be printed after *
  Serial.println(temp); //* "Current Temperature" for neatness and ease of use
}

1 Answers1

0

I think you can use delay function