Oscilloscope probing shows pin transition points to be unstable. Simulating the above code in MPLAB X IDE confirms this. Something in the core is causing the interrupt vector routine to fire in a several µs window around the expected time. Trying a different Attiny core makes it mostly disappear. I say mostly because there is still something causing spurrious timing errors in that core as well. Also I am unable to flash the Digispark with that code.
The following code does not function as expected: https://gist.github.com/LightningStalker/ecaf6b26f6c48334a6190d6a4ce945c1
Oscilloscope probing shows pin transition points to be unstable. Simulating the above code in MPLAB X IDE confirms this. Something in the core is causing the interrupt vector routine to fire in a several µs window around the expected time. Trying a different Attiny core makes it mostly disappear. I say mostly because there is still something causing spurrious timing errors in that core as well. Also I am unable to flash the Digispark with that code.