Sensor Serial Monitor

hey, i got problem in my arduino code, when i push the button on, it just appear serial monitor for just 3 seconds, how i can make it still update until i push the button off? thanks.

const int buttonON 	= 7;
const int buttonOFF = 4;	
const int ledPin 	= 8;  
int 	  sensorPin = A1; 

int buttonState = 0;     

void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(buttonON, INPUT);
  pinMode(buttonOFF,INPUT);
  Serial.begin(9600);
}

void loop() {
   int reading = analogRead(sensorPin);  
   float voltage = reading * 5.0;
   voltage /= 1024.0; 
   float temperatureC = (voltage - 0.5) * 100 ;  
   
   buttonState = digitalRead(buttonON);
  if (buttonState == HIGH) {
    digitalWrite(ledPin, HIGH);
    Serial.print(temperatureC, HIGH); 
    Serial.println(" C");
    if	(temperatureC>=70);
    	digitalWrite(ledPin, LOW);
  }   
  
  	buttonState = digitalRead(buttonOFF);
   	if (buttonState == HIGH) {
    digitalWrite(ledPin, LOW);
  
  }
}

@rian2001, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the Installation & Troubleshooting category.

Please edit your post, select all code and click the </> button to apply so-called code tags and next save your post. It makes it easier to read, easier to copy and prevents the forum software from incorrect interpretation of the code.

Your LED does not have a current limiting resistor.

I don't see a reason for the 3 seconds; is that the time that you keep the buttonOn pressed?

If so, set a variable when you detect that the buttonOn is pressed and clear the variable when the buttonOff is pressed.

void loop()
{
  static bool showReading = false;  

  int reading = analogRead(sensorPin);
  float voltage = reading * 5.0;
  voltage /= 1024.0;
  float temperatureC = (voltage - 0.5) * 100 ;

  buttonState = digitalRead(buttonON);
  if (buttonState == HIGH)
  {
    showReading = true;
  }

  buttonState = digitalRead(buttonOFF);
  if (buttonState == HIGH)
  {
    showReading = false;
  }

  if(showReading == true)
  {
    digitalWrite(ledPin, HIGH);
    Serial.print(temperatureC, HIGH);
    Serial.println(" C");
    if (temperatureC >= 70);
    digitalWrite(ledPin, LOW);    
  }
  else
  {
    digitalWrite(ledPin, LOW);
  }
}

do u have suggest what should i do to make the serial monitor keep updating?

Did you look at the code in post #3; something you don't understand?

Did you try it? If so, what happened; how did the expected behaviour differ from what you need?

    if	(temperatureC>=70);
    	digitalWrite(ledPin, LOW);

You might want to fix that.