 }
 
 void HallISR(){
-  hall_counter++;
+  ++hall_counter;
 }

double hall_counter = 0;
double rpm = 0;
unsigned long last_time = 0;
const double hall_sample_rate = 100;

double pwm = 0,setpoint = 1500;
double Kp=5, Ki=3, Kd=1;
PID pid(&rpm, &pwm, &setpoint, Kp, Ki, Kd,100000,ON,REVERSE,0,255);

void setup()

  digitalWrite(motor_pin_1,LOW);
  digitalWrite(motor_pin_2,HIGH);
  
  last_time = micros();
}

void loop()
{
  
  if((micros() - last_time) >= hall_sample_rate){
    rpm = ((hall_counter * (1000000.0f/(double)(micros()-last_time))) * 60);
    hall_counter = 0;
    last_time = micros();
    
    if(DEBUG){
      Serial.print(rpm);
      Serial.print(",");
      Serial.println(pwm);
    }
  }
  pid.Computing();
  analogWrite(enable,pwm);
  
