Is it possible to pass variables to delayMicroseconds()?

Does anybody know of any way to pass a variable to delayMicroseconds?

I need to be able to pass a dozen or so changing variables: from, say, 10µs to 15000µs.

Can you do that in a subroutine or something?

Thanks!
Ian

Yes.

Google tells me that you can.

delayMicroseconds()
Description

Pauses the program for the amount of time (in microseconds) specified as parameter. There are a thousand microseconds in a millisecond, and a million microseconds in a second.

Currently, the largest value that will produce an accurate delay is 16383. This could change in future Arduino releases. For delays longer than a few thousand microseconds, you should use delay() instead.
Syntax

delayMicroseconds(us)
Parameters

us: the number of microseconds to pause (unsigned int)
Returns

None

But VinceHerman, you can only put a number in there (between 4 and 16k or so): not a variable. And DVDDoug… can you show me how to do it, if it really is 'yes'? I can't make anything work.

Try this

unsigned long numberOfMicros = 1000000UL; // this is intended to be 1 million in case I got the 0s wrong
delayMicroseconds(numberOfMicros);

...R

I think it is time for you to show the code that you say does not work.

Doh! Sorry, and thanks, guys. Trying to build a simple module to show you why it doesn't work… and IT WORKS!

That is one of the reasons we ask for code!