Help with programming Pololu Maestro 12

Hello.

I don’t see anything wrong with your script, but please keep in mind that the Maestro’s internal clock is not as accurate as a watch. The crystal itself has a 0.1% tolerance, so it could lose or gain as much as 86 seconds every day. Also, the Maestro has many tasks to take care of concurrently, so the execution of time of the script can sometimes be hard to predict.

I see you have a lot of arbitrary numbers in your code that affect how long it will take. Have you calculated how long each part of the code should take and made sure that it adds up to 24 hours?

In order to prevent noticeable drift over the months, I would power the Maestro from a wall power adapter that is in turn powered by some sort of standard AC outlet timer. I would expect these timers to be much more accurate than the Maestro. The timer should turn the Maestro off for some time every night in order to reset the Maestro’s clock and the state of your script. Then you don’t actually have to worry about doing the calculations to make sure that your loop takes exactly 24 hours to execute.

–David