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
Controlling Time
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- akyi
- Posts: 9
- Joined: Tue Feb 21, 2017 12:53 am
Controlling Time
- Attachments
-
- 20170329172529360.pdf
- (88.86 KiB) Downloaded 37 times
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Controlling Time
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.
- akyi
- Posts: 9
- Joined: Tue Feb 21, 2017 12:53 am
Re: Controlling Time
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
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
- adafruit_support_bill
- Posts: 88097
- Joined: Sat Feb 07, 2009 10:11 am
Re: Controlling Time
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
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
Please be positive and constructive with your questions and comments.