Arduino Servo Library and cutting off power to speed control

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 {

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.


any thoughts would be greatly appreciated.

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

any suggestions?

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!

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!