What happens if you switch the lines ?
just to test if this happens in the sensor/wiring or in the software?
100 times higher could mean more noise on the line, which is seen as pulses for the interrupt handler. (Or leakage?)
Is the factor a constant or irregular?. If it is a constant (exact 100x) you might just have 2 different devices !
If it is irregular it looks more like noise.
You can add this modification to the sketch to remove the noise. It ignores pulses that are too short after each other.
Be aware that micros() returns multiples of 4. So testing with 8,9,10,11 give the same behaviour.
void CounterIN()
{
static unsigned long lastTime = 0;
if (micros() - lastTime > 10) // to be adjusted
{
lastTime = micros();
countIN++;
}
}
void CounterOUT()
{
static unsigned long lastTime = 0;
if (micros() - lastTime > 10)
{
lastTime = micros();
countOUT++;
}
}