Hello, I had a question. I read a long time ago that there should be slight delays between commands to servos and escs. Is that true? If so, how long? I'm building an auto-leveling UAV, so I'd like the delays to be short as possible... my current code is running delay(10); which is just a placeholder until I have an actual value.
What ever you do you do not use delay!. See the "blink with out delay" example and look out FSM' (finite state machines) in the playground. Are these commands to one servo ?
Mark
If the delay is for only 10 milliseconds, does it matter if I use delay instead of millis? And I have 2 servos and 3 escs.
I read a long time ago that there should be slight delays between commands to servos and escs.
Where did you read that, what was the technical basis, and have you tried code both with the delay and without?
gln6fgsl:
If the delay is for only 10 milliseconds, does it matter if I use delay instead of millis? And I have 2 servos and 3 escs.
10 ms is a long time at 16 MHz. And besides, during delay(10) for one servo the others can't change which gives you lousy response.
Best approach is the do-things-on-time approach.
IMO that extends to processing text as it comes in rather than the time-wasting standard buffer text then process approach.
Learn BlinkWithoutDelay and find out why unsigned long is generally best for handling time, not just for this one project but for most of your future projects.
I guess someone knowledgeable about timer operation could look at the servo library to see how it handles updating the duty cycle value per pwm cycle time. It would make no sense for the library to try and update a new duty cycle value sooner then the completion of an existing output pulse/cycle which like is 20 millisecond frame. I would suspect that sending new values to a servo quicker then one frame time does nothing but make the change on the next 20 millisec frame. And as a timer can or is servicing more then one servo I think your question is a good one, but suspect you can send new values to a servo a fast as you want with no negative effect on the servo, it will get there when it gets there.
Lefty
Sorry for the late response, just started a new job today and my ISP was on the fritz yesterday.
To zoomkat: I can't remember, it was an article about a year ago... and I have not tried without the delays.
To GoForSmoke: Um... what is IMO? Googling got me international maritime org. I'm pretty sure that's not what you're talking about.
To retrolefty: Please excuse me if I'm being an idiot, but the way I understood your response is: Since the signal to the servos are on different pins, the delay shouldn't matter. Just wanted to put it in my own words so I know I understood your answer correctly.
Um... what is IMO?
In My Opinion.... or seeing as we're quoting him, IHO 8)
To zoomkat: I can't remember, it was an article about a year ago... and I have not tried without the delays.
Why not? it is cheap and easy.
Not complete but it's got the most common ones and some less common:
Glossary of Modern Internet Jargon and Abbreviations
HMU, BISLY, BRB, NWOT, IMHO, RTFM, and other acronyms...
Apart form saying use the Servo lib. see the servo (see examples)
You can't not have a "delay" (known as a space) between pulses (known as marks). The duration of the mark is between 500 and 2500 micro seconds. Exact values depend the servo. The space is around 20 mills. A mark of 1500 micros will center the servo.
Mark
I'm using the writeMicroseconds() function from the servo library. Can you explain "A mark of 1500 micros will center the servo." And 1500 micros is what, 1.5 millisecond?
holmes4:
Apart form saying use the Servo lib. see the servo (see examples)You can't not have a "delay" (known as a space) between pulses (known as marks). The duration of the mark is between 500 and 2500 micro seconds. Exact values depend the servo. The space is around 20 mills. A mark of 1500 micros will center the servo.
Mark
Is that for PWM control?