Add a variable number to each loop

I'm working on making a automated sawmill. The mill will have a rotary encoder to set the cut depth. The cut depth will be the same from the top of the log to the bottom.

What I need is to have a number and add a variable number. Then add the last number and another variable number to each loop. I've been looking for some time and I cant seem to find what I need.

Your post does not make much sense and is not asking a question.

You need to have a zero point. Then for each pass of the saw you multiply the pass 'number' (1, 2, 3, 4, 5, etc) by the thickness you are milling to set the new depth of the saw.

What is it you need to find?

As Marco says, you question is not clear but is this the sort of thing you are looking for ?

int thickness = 123;
int cutDepth = thickness;

void setup() 
{
  Serial.begin(115200);
  for (int cutNumber = 0; cutNumber < 10; cutNumber++)
  {
    Serial.print("Cut number ");
    Serial.print(cutNumber);
    Serial.print("\tCut depth ");
    Serial.println(cutDepth);
    cutDepth += thickness;
  }
}
void loop() 
{
}

Thanks the the reply

The mill has to return above the log after finishing a cut. Then drop below the last cut to the next cut and so on.

I cant figure out how to get it to remember the last cut depth.

I cant figure out how to get it to remember the last cut depth.

See my example program above.

UKHeliBob:
As Marco says, you question is not clear but is this the sort of thing you are looking for ?

int thickness = 123;

int cutDepth = thickness;

void setup()
{
  Serial.begin(115200);
  for (int cutNumber = 0; cutNumber < 10; cutNumber++)
  {
    Serial.print("Cut number “);
    Serial.print(cutNumber);
    Serial.print(”\tCut depth ");
    Serial.println(cutDepth);
    cutDepth += thickness;
  }
}
void loop()
{
}

I look into it that may do the trick.

Thanks