tachometer, review of methods

Here is a review of my methods for the simple tachometer routine (using a while() loop) and the hall sensor with a neodymium magnet:

Link to tutorial: Arduino Hall Sensor Tachometer

  while(true){
    if (digitalRead(hall_pin)==0){
      if (on_state==false){
        on_state = true;
        hall_count+=1.0;
      }
    } else{
      on_state = false;
    }
    
    if (hall_count>=hall_thresh){
      break;
    }
  }

Here is an image of my setup using a hall sensor and a magnet. It's affordable and reliable: