Display BPM value

Status
Not open for further replies.
[UPDATE]
i have updated my code with this

Code:
int previousClockTime = 0;
int clockCounter = 0;
int averageClockTime = 0;

void RealTimeSystem(byte realtimebyte) {
  if (realtimebyte == 248) {
    counter++;
    if (counter == 24) {
      counter = 0;

      uint32_t currentTime = micros();
      uint32_t timeDiff = currentTime - previousClockTime;

      uint16_t bpmx = 60000/timeDiff;
      Serial.println(bpmx); 
      
    }

    if (counter == 12) {
      
    }

  }

  if (realtimebyte == START || realtimebyte == CONTINUE) {
    counter = 0;
    
  }

  if (realtimebyte == STOP) {
   
  }

}

but i get 0.00 instead of bpm value...
 
Status
Not open for further replies.
Back
Top