|Incrementing array with sensor values at different times?
|Page 1 of 1|
|Author:||Cyks [ Mon Mar 09, 2015 2:17 am ]|
|Post subject:||Incrementing array with sensor values at different times?|
So we want our robot to move a small distance, take a sensor reading, and add it to the next unused array slot many times throughout our program, then we want to compare it to the last value. How can you use the previous or next array slot without naming the number of it exactly? All I can find is how to make a for loop that increments it but stays in the loop until it is done. Does anyone have experience with this sort of thing? Any help is greatly appreciated!
|Author:||JohnWatson [ Mon Mar 09, 2015 10:29 am ]|
|Post subject:||Re: Incrementing array with sensor values at different times|
You may want to simply use a variable to keep track of what index of the array you are currently on, and add/subtract from that value as needed:
You will have to be very careful that you don't lose track anywhere along the way, or go over the predefined number of array indices (in this case, 40).
|Page 1 of 1||All times are UTC - 5 hours [ DST ]|
|Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group