Arduino Servo Library and cutting off power to speed control

Greetings,
I have a sketch I am working on that uses the Servo.h library to manage a speed controller. I have everything working except for a key safety feature. In a certain situation I need to completely stop the engine using the speed control. Currently I am just using the following code to stop the engine:

if (run == true) {
jets.writeMicroseconds(pulseLength + pulseBase);
delayMicroseconds(pulseInterval - pulseLength);
} else {
jets.writeMicroseconds(1000);
delayMicroseconds(19000);
}

The else block sends the correct command to stop the engine. But I get a time lag of about .5 seconds. Does anyone know of a way to improve this? I know the Servo library uses Timer1 under the covers so i was thinking maybe an interrupt. But I don't see a way to trigger an interrupt programmatically from inside my sketch. Another thought i had was detaching the pins using Servo.detach().

any thoughts would be greatly appreciated.

thx

any thoughts would be greatly appreciated.

I think that your assumption that the delay is caused by that snippet is wrong.

any suggestions?

r737lundgren:
any suggestions?

Perhaps you could post a couple more random snippets. Or, save us all a bunch of time. POST YOUR CODE - ALL OF IT!

PaulS,
i just did some better analysis. my code is actually doing the best job it can. it always takes my speed control .5 seconds to stop. I guess just latency in the system. thanks for taking a look!