multiple IR senors RPM calculation help need

hey i am new here, i am working on a Tachometer with 2 IR sensors to calculate rpms from 2 spinng shafts.

need help

i have this function for single calculation.

void calculateRPM() { startTime = lastDebounceTime; lnTime = startTime - endTime; RPM = 60000 / (startTime - endTime); endTime = startTime;


how to use multiple calculation.

void loop(void) {

time = millis(); int currentSwitchState = digitalRead(IRSensorPin);

if (currentSwitchState != lastInputState) { lastDebounceTime = millis(); }

if ((millis() - lastDebounceTime) > debounceDelay) { if (currentSwitchState != inputState) { inputState = currentSwitchState; if (inputState == LOW) { digitalWrite(ledPin , LOW);


If you have 2 sensors which give different readings, then you will need to record the start time, debounce time and end time for each one.

Also, in your function you calculate InTime but then you don't even use it in your division wasting processing time.