Map potenciometer value

Hello dear forum users!

I have a question that bothers me a lot.

I have 270 degree pot ant I want to map it from 1023 to 32000 (for simulating input of joystick)

Problem is that pot on my device is capable to rotate only 180 degrees, and I my pot value is not stable.

but that is just a beginning! I have pedals from steering wheel, that have pots to. those pots turns max 90 degrees or even less than that... How to map that small value from 0 to 200 or so to 32000?

Maybe there is hardware solution, or some one did that already...

int pot270degrees = analogRead(A0); // 0.. (1023*180/270) = 682

int x = pot270degrees * (32000.0 / 682);

int pot90degrees = analogRead(A1); // 0..200

int y = pot90degrees * (32000.0 / 200);

Thanks for quick response. :slight_smile:

I will try this type of calculation. :slight_smile: