Controlling Time

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
akyi
 
Posts: 9
Joined: Tue Feb 21, 2017 12:53 am

Controlling Time

Post by akyi »

Hi, I need some help controlling when things happen with my arduino. I am currently using two stepper motors, and the adafruit motor driver v2.

I attached a pdf describing what I need to do in a timeline. I know how to code for how many steps the motor has to go, delaying, and releasing the voltage. The bigger problem is that I need to execute a certain number of actions at the start of the program once, wait for one hour, and then another set of actions one hour from the start. That entire process is more clear on the pdf, but do you have any advice on how to code for this?

I already tried adding a delay after I released voltage to the motors, the problem is that I need a more precise method. I don't actually know how long it takes the motors to do their things, and figuring out how long that is is being a problem.

Thanks
Attachments
20170329172529360.pdf
(88.86 KiB) Downloaded 37 times

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Controlling Time

Post by adafruit_support_mike »

Your best bet would be to use an RTC to keep track of the time. With that, you don't have to worry about estimating the time it takes to complete an operation. You just call the clock again when the operation is done.

User avatar
akyi
 
Posts: 9
Joined: Tue Feb 21, 2017 12:53 am

Re: Controlling Time

Post by akyi »

Hi Mike,

Thanks for your response! Is the RTC function on Arduino Uno's as well? After a quick search online, it only seems available on the Arduino Zero.

Thanks,
Albert

User avatar
adafruit_support_bill
 
Posts: 88097
Joined: Sat Feb 07, 2009 10:11 am

Re: Controlling Time

Post by adafruit_support_bill »

You can add an RTC to the UNO as a breakout board: https://www.adafruit.com/products/3013
There is also one built into the logger shield: https://www.adafruit.com/products/1141

And if you don't need the accuracy of a hardware RTC (the Arduino clock can drift by a few minutes per day) there is a "softRTC" function built into the RTC Library: https://github.com/adafruit/RTClib

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”