Creating variables as a variable...

Hi , I am currently working on a lapcounter for time measuring purposes. Now the simple time measuring work pretty well and the data is shown on a 2 line LCD display. There is no connection to a PC via RS232 yet.

What I am now tring is to store the laptimes in the arduino in order to flip through the laptimes i.e. after the race. Obviously I want to keep the system flexible. So the number of laps counted shall not be limited. To store the data I need to have a variable related to the lap...and the highest lapnumber is unknown. So something like that would be ideal

elapsed_time = (millies()- starttime);  //get the laptime
lapcount = lapcount +1;                     // get the lap
x = lapcount;               //let's take X=52 as example
int laptime(x);              // define variable with lap...HERE IS THE ISSUE
laptime52= elapsed_time;

Is that just silly or is here a possible solution?

You need to read about arrays, or linked lists (not recommended, given limited memory)

So working with arrays I would need to give the arduino an array of 250 :o (what I would call a maximum) and fill it with data afterwards? Filling in millis would overfill the RAM, wouldn't it?

would need to give the arduino an array of 250

If that's the maximum number of laps, yes. 250 "long"s would take up just short of 1Kbytes of RAM.

Dear AWOL, thanks for your hints. That was very helpful! [smiley=happy.gif]

Thread closed...