PDA

View Full Version : Math with Potentiometer Control of Servo (again)

MichelB
10-22-2009, 11:36 PM
In W-a-M, pages 154-155, Programming Potentiometer Control of the Servo it' written:
time values that were measured by Parallax...
All the way clockwise:·········· 1
All the way counterclockwise: 691
In my case: 1 - 604
"So how can these input values be adjusted so that they map to the values of 500 and 1000", in my case 310 and 1190 (1).
1190 - 310 = 880
(1) to obtain a range of 180°, 90° (310) 0° (750) -90° (1190) with my components.

Scaling:
time max = 691 x 500 / 691 = 500, in my case: 604 x 880 / 604 = 880
time min = 1 x 500 / 691 = 0.724, in my case: 1 x 880 / 604 = 1.457

Offset:
time max = 500 + 500 = 1000, in my case: 880 + 310 = 1190
time min = 0.724 + 500 = 500,·in my case: 1.457 + 310 = 310

new fractional value = 0.724x256=185, in my case 1.457x256=374

time = time */ 185, in my case: time = time */ 374
time = time + 500, in my case: time = time + 310, etc., etc.

Is my math correct? If yes, I can't solve the same problem in SW21-EX26-Servo_Control.bs2 because the MAX 500, I think.