I have just joined this forum, and have been doing some work with an arduino mega over the last couple of months. Rather new to this, and I have been drinking from a fire hose....I have a couple of questions which I am hoping someone an help me with, or point me in the right direction...
I want to use stepper motors for my project, but I have the need to implement a "mechanical turns counter" if you will, with an arduino mega....in other words, I want to be able to count how many turns my stepper motors turn in one direction, and increment the counter, and then how many turns they turn in the opposite direction, and decrement the counter..in this way, I can calculate how far the servo has traveled, and then display that on an LCD...and do further calculations in my application.
I am thinking, that the way to do this, is to use a dual shaft stepper, and then couple a rotary encoder to one shaft, and have the encoder provide feedback as to the stepper rotation, as well as direction, and count the rotations this way....does this sound correct?
here is where it gets interesting....now, when I shut the arduino mega down, I then also want to be able to recall the last values of the encoders, so that when the program starts up again, I know where the steppers are, in other words, their positions when the unit was last powered down....this is like a mechanical counter as I said....which counts then displays the digits, but has the digits displayed next time you look at it.... I would rather not have to go through an indexing routine each time I power up, but have a means of determining where the steppers are last time the unit was powered down...hope this makes sense?
Since the encoder will start again from neutral when the board gets powered up, how can I determine where it last left off?
Also, I have the need to use the Frequency counter library in my application to read freq., but as I understand it, it uses interrupts and slaves them to pin 47 (on a mega), and if used with any other code which uses interrupts, it does not work. I have confirmed this by using the servo library (NOT the softservo), and this library does NOT work, if I am also using the Freq. Counter library....I know the mega has many more interrupts, but my head is spinning trying to figure how to make the two work together....
Any suggestions? Where can I get some insight on this?
Thank you all in advance for your guidance and help!!