I'm trying to make my robot stay inside an arena while saving sensor values in an array every second. I have managed to achieve both of these tasks but cant get the code working together.
The following code works using the "wait10Msec(100);" line of code but as expected this causes the rest of the code to pause and my robot will stray out of the arena.
for(int i = 0; i < 60; i++)
lightvalues[i] = SensorValue[lightSensor];
I realize I must have to use timers but when I try to use them instead of the array saving a value every second every element in the array changes. I've spent hours trying to get my head round this but cant figure it out.
Any pointers would be much appreciated! Thanks.