Settable counting float

Hello all!

I'm trying to figure out how to generate a float value that would count from a variable low set point to a variable high set point and a variable speed and back.

Ex. Pot 1 sets low to 3
Pot 2 sets high to 20
Pot 3 sets counting interval to 1 sec

3, one second delay, 4 one second delay .....to 20 then back down again.

Also I need to avoid delays as this will be running in a pretty extensive loop that is monitoring other variables at the same time.

Thanks in advance.
-Dustin

Apart from the fact of whyyou want to do this in the first place why does it have to be a float?

To calculate the increment value just take the diferance between the finish and start numbers and divide it by the number of steps you want it to take.

I'm not sure I understand how to code what you're telling me.

As far as the why I'm feeding a 4-20ma PID loop which is coded to get it's setpoint from a float. It's a very stable and well written code so I really didn't want to mess with it too much if I could avoid it.

Give an example of a situation where you need a floating point value.

Something like this ?

if (millis() - prevCountMillis >= countIntervalMillis) {
   prevCountMillis += countIntervalMillis;
   bottom = analogRead(pot1pin);
   top = analogRead(pot2pin);
   countIntervalMillis = analogRead(pot3pin) * something;
   count += step;  // will be either +1 or -1
   if (count >= top or count <= bottom) {
      step = -step;
   }
}

...R