So say i have 100 or more comparisons to do.....and each of the 100 values, needs to move the stepper/servos to some location, i would have to write 100 'if' statements?
Do not get me wrong, I am not lazy, just trying to figure out the best and most effecient way to go about this....i was thinking along the lines of some algorithm that depending on the value we read at some pin (close enough is ok), we do some sort of a process to extract the two values needed to move the motors....so something like pass the value i just read to a function, the function returns the two proper movement commands to the motors which correspond to that value which was passed....
Almost like each time the value is passed, parse say some file stored in flash or eeprom, and stop where this value is close enough to what we need, then return the two stepper values needed to move the motors corresponding to this value...
This file could be tab delimited or some other format, and contain entries which have three values...the first value is what we are trying to match...the second two values are the first stepper and second stepper commands...we then move to the next entry....etc.....
This way, we would only need to do this parsing as needed, stopping and matching to the location we need....Offcourse we would need to read this file each time, but a file containing say 100 such formatted entries would not be so large, and could afford the computational time....
We would then also have logic to say that if a match is not found, give the option of storing this new value, along with the two stepper locations to the user....
Not sure i am making any sense.....thoughts?