I hope I was helpful. Glad to help if I was.

I'm thinking of something totally new and better for these slot cars. I know only the kid controllers I used 50 years ago!

I do know programming and have linearized many processes in the prepress world.

I think I'm seeing what you want to accomplish - a perfectly linear (with speed) hand controller for forward and reverse.

Since you're going to implement a lookup table anyway for speed and flexibility, let the lookup table do the whole thing, both sides of the curve and the dead zone,

say values 121 - 135, (16 values centered on 128) are zero.

Then for both the forward and the reverse you take actual speed readings for say 10 forward and 10 reverse controller settings.

You "invert" the response curves, either mathematically or graphically, and enter those values into the lookup table, interpolating the inbetweens.

Say your top speed is measured at 50 mph at full, 255 throttle. 135 is to be 0 (top of dead zone). That means you want your controller to have 120 steps from 0 to 50 mph.

The exact middle settting, 60 + 135 = 195 should cause 25 mph. You look at your response curve (draw a hor line) and see that 25 mph actually happened at

controller position 100. Therefore you store a 100 in lookuptable[195]. lookuptable is an array of 255 bytes.

So far lookuptable of 135 is 0, 195 is 100, and 255 is 255. You do this for all 120 positive speeds and all 120 reverse speeds.

You now have your table. No on-the-fly calculations; just near instant table lookups. Outside the dead zone, speed is perfectly linear with throttle position.

(Your code makes sure to switch the voltage direction for values below 121).

This brings up an interesting question about slot car racing. Do people indeed want and implement a "velocity pedal", rather than an "acceleration pedal".

If so, is that only because it is hard to get the current velocity, which is what would be needed for a true accelerator pedal like in a car?

If you could read back velocity (wheel speed) and implement an accelerator in the mathemeematic sense of the term, would that be better or worse for slot car racing.

In other words, if you push the throttle position forward a little, the velocity starts constantly increasing at a slow constant rate. Push it further and the rat of speedup increases, like in a real car.

The above described lookuptable implements a perfect, calibrated velocity pedal.