Hi,
I'm working on a mechanical clock:
The clock uses one servo that has to be actuated once every minute. The design uses Geneva gears to increment the other digits automatically. For example, after the right-most digit goes to 9, the digit next to it automatically gets incremented when the right-most digit flips from 9 to 0.
I have everything working and I'm currently using the Servo example "Sweep" modified as follows:
/* Sweep
by BARRAGAN <http://barraganstudio.com>
This example code is in the public domain.
modified 8 Nov 2013
by Scott Fitzgerald
http://www.arduino.cc/en/Tutorial/Sweep
*/
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop() {
for (pos = 0; pos <= 38; pos += 1) {
// in steps of 1 degree
myservo.write(pos);
delay(100);
}
for (pos = 38; pos >= 0; pos -= 1) {
myservo.write(pos);
delay(100);
}
}
This works as a demo, but as you can see from the video, it just increments the numbers but isn't keeping time. Basically, I need to have it sweep from 0 to 38 and back once per minute and then stop until the next minute. Everything else is automatic. Looking for tips on how best to accomplish that. I know time can be tricky when it needs to be accurate. Thanks.