// Reads the flame sensor every 1 second
  void senseFlame() {
    for(;;) {
      bool val = flame->flameDetected();
      if (val) {
        cout << "Flame detected." << endl;
        alarm();
      }

      else
      {
        cout << "No flame detected." << endl;
        sleep(1);
      }
    }
  }
 // Reads the flame sensor
 bool flameDetected() {
   return flame->flameDetected();
 }