Bluetooth wont wait input

Hi guys,
I’m a new programmer here. Recently, I’m designing a Bluetooth arduino smoker temperature controller. Somehow, the it does not wait me to type the input and just jump to the loop after it. Please see attachment for my code. I tried similar code on my Bluetooth turn table, and it works fine. I don’t know why it won’t wait type the input.
PLEASE HELP~~~~~
I’d appreciate it.

Jianghan

Thermistor.ino (1.22 KB)

  if (Serial.available()) 
  {
    pretemp = Serial.parseInt();
    Serial.println(pretemp);
  }

  thermistorReading = analogRead(thermistorPin);
and so on to more code

Which code will be executed whether or not serial data is available ?

Thanks for reply. when open the serial monitor, it shows

Please input pre-set temperature in F:

then it jump to 364tempeature in Fahrenheit:319 tempeature in Celsius:159

it won't wait me input any data.

I think it just skip over following code.

if (Serial.available()) 
  {
    pretemp = Serial.parseInt();
    Serial.println(pretemp);
  }
if (Serial.available()) 
  {
    pretemp = Serial.parseInt();
    Serial.println(pretemp);
  }

Think what will happen if no serial data is available. Will the program stop and wait for some to be available, and if so, why, or will it always carry on to the code immediately after the test for serial data ?

Thank you!! it explain everything. I think I know how to fix it now.

The examples in Serial Input Basics may be useful.

...R