I'm putting together a replica of the Horus Guard helmet from the original Stargate movie, and I need help with the animatronic unit.
I've been working off a great Instructables guide (found here) and have the animatronics described there working fine. However, the movements are a little jerky. (Warning: Loud audio) I'd like to make them slower and smoother, like in the movie. (Not as loud)
I've attached the code provided in the Instructable, but my Arduino kung-fu is still weak. Aside from adding way more movements in much smaller increments, I can't figure out a solution.
Thoughts?
Horus_Code.ino (1.8 KB)
Aside from adding way more movements in much smaller increments, I can't figure out a solution.
What is wrong with that solution, as long as you don't block the free running of loop(), of course.
Have you investigated the VariableSpeedServo library ? May be too slow for your project but...
You can get finer resolution using writeMicroseconds() (0 degrees = 544, 180 degrees = 2400), about 10.3 microseconds per degree, IF your servos are good enough quality to take advantage.
UKHeliBob:
What is wrong with that solution, as long as you don't block the free running of loop(), of course.
Nothing is wrong with it, but I was hoping for a more efficient solution. 
UKHeliBob:
Define efficient
The laziest route to a positive result, I guess?
I come from the world of Excel, so I'm plenty familiar with things like nested IF functions and how often a gargantuan IF function can be replaced with a much simpler function that accomplishes the same thing. More importantly, while repeating the same basic commands over and over with incremental differences is a functional solution, the length of the final result would make finding and fixing an error that much harder.
At the end of the day, my Arduino kung-fu is weak and I didn't want to do hours of coding and error-hunting just to discover that there was an easier way all along.

edgemoron:
Have you investigated the VariableSpeedServo library ? May be too slow for your project but...
GitHub - netlabtoolkit/VarSpeedServo: Arduino library for servos that extends the standard servo.h library with the ability to set speed, and wait for position to complete
You can get finer resolution using writeMicroseconds() (0 degrees = 544, 180 degrees = 2400), about 10.3 microseconds per degree, IF your servos are good enough quality to take advantage.
Cool! This looks like it'll be really helpful. 
repeating the same basic commands over and over with incremental differences is a functional solution, the length of the final result would make finding and fixing an error that much harder
The principle is simple. No need to "repeat the same basic commands over and over with incremental differences"
start of loop()
if the servo is moving
get millis() value
if it is time to move the servo a little
move it and save the time
end if
end if
//other commands in loop() go here
end of loop()