Transforming a PWM signal correctly

Yes. I didn’t say the maximum delay, I just omitted saying , useable for an accurate result.

Mind you, I did run some test values over that threshold and didn’t notice any real difference in my readings, given the fluctuating result values anyway, so how “inaccurate” the figures become over that could be fairly small, at least in my sample range.

I can't see what is being said here. "micros()" is an unsigned long - it does not stop at 32768, let alone 16384. And there are only 16000 clocks in a millisecond. :worried:

delayMicroseconds() takes an unsigned int as its argument and (but) for some reason is said in the documentation to produce inaccurate results for values over 16383.

a7

I have no idea why, but I’m assuming if the offical documentation says it, it must be true.

Ah! I see. A (deliberate) kluge in the delayMicroseconds() code. It accepts only an unsigned int even though micros() is an unsigned long. The answer is simple - if you want flexibility, do not use it! Just note the value of micros() and wait till it has increased by the desired amount, just as you do with millis().

The reason for the wonky function is to simplify it and thereby reduce the function calling delays when you want very short times.