const float BETA = 3950; // Should match the Beta Coefficient of the thermistor

bool flagSend = false;

void setup() {
  Serial.begin(9600);
}

void loop() {
  float temperature = getTemp();

  if ((!flagSend) && (temperature > 30)) {
    flagSend = true;
  }

  if (temperature <= 30) {
    flagSend = false;
  }

  Serial.print("    Send Flag: ");
  Serial.println(flagSend ? "true" : "false");

  delay(1000);
}

float getTemp() {
  int analogValue = analogRead(A0);
  float temp = 1 / (log(1 / (1023. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;

  Serial.println("\x1b[2J\x1b[;H");
  Serial.print("  Temperature: ");
  Serial.print(temp);
  Serial.println(" ℃");

  return temp;
}