Go Down

Topic: interrupt and millis, have questions (Read 1 time) previous topic - next topic

PaulS

I said that the duration between changes will seem, to the Arduino like an eternity. There is the possibility that I am wrong. I was once. If it turns out that I am, there is a faster method than calling digitalRead three times.

Quote
I was only planning to poll one sensor at a time, then compare values.

You need to poll all three sensors. Otherwise, how would you know what to compare?

dglstrp

OK, change duration, got it.

AS to the second part of your reply, I was going to poll them sequentially, for a short time period, store the three values, compare the three values, make a decision, then repeat if I haven't gone past 20 seconds since the function was activated.

If the count doesn't match, then one of the gearboxes is broken. And I hit stop.

I figure at 20 RPM, running for 20 seconds, the motor is going to rotate less than 10 times, I thought the Arduino would be fast enough to go through four or five iterations during the 20 second  motor run time.

That is why I was also asking if there was a way to compare within a range, like (X == Y == Z within 5) to account for one encoder or another starting high or low compared to the other two.

SO basically, you are saying that counting pulses isn't going to work for what I am trying to do? Or are you trying to get me to look at something completely different in your own way?

If so, please spell it out, my wife will tell you that even after 20 years I don't take hints very well at all.

I'm not asking you (or anyone) to write the code, but I am surely missing what you are trying to tell me.



PaulS

Quote
SO basically, you are saying that counting pulses isn't going to work for what I am trying to do?

Counting pulses will work. You'll need to see if the absolute value of cnt1 - cnt2 is greater than some value, and if absolute value of cnt1 - cnt3 is greater than some value, and if absolute value of cnt2 - cnt3 is greater than some value. If so, panic.

Those fins are pretty wide. The encoder will stay high for a long time, so never mind about my concerns that you might miss a change. It isn't when the change occurs that is critical in your application. It is that a change has occurred that is important.

Go Up