 double getAngle();
 
 // Sound Sensor
-int sensorPin = A0;    
-int ledPin = 13;      
+int sensorPin = A0;   
 int sensorValue = 0;
 bool robotOn = false;
 bool soundStart();
+
+// Extinguisher
+void extinguish();
 
 void setup() {
   Serial.begin(9600);

#define SOUND_LED 52

#define WALL_DISTANCE 7

Motor leftMotor1(3, 4);
Motor leftMotor2(5, 6);

  hDrive(0.0, 0.0, 0.0);
}

void extinguish() {
  for(int i = 0; i <= 180; i += interval){
    extingusher_servo.write(i);
    delay(15*interval);//give time for servo to move

    if(!digitalRead(flame_sensor))
      digitalWrite(FLAME_LED, HIGH);
  
    //turn on fan
    fan_motor.set(1);
    while(!digitalRead(flame_sensor)){
      //while there is a fire
      delay(1000);   
    }
    //turn off fan
    fan_motor.set(0);
    digitalWrite(FLAME_LED, LOW);  
  }
  
  for(int i = 180; i >=0; i -= interval){
    extingusher_servo.write(i);
    delay(15*interval);//give time for servo to move

    if(!digitalRead(flame_sensor))
      digitalWrite(FLAME_LED, HIGH);
  
    //turn on fan
    fan_motor.set(1);
    while(!digitalRead(flame_sensor)){
      //while there is a fire
      delay(1000);   
    }
    //turn off fan
    fan_motor.set(0);
    digitalWrite(FLAME_LED, LOW);  
  }
}

