Cockpitbuilders.com
Main => General Discussion Board. => Topic started by: 727737Nut on February 12, 2012, 05:35:06 PM
I have a unique problem I need to solve via math. As I turn a potentiometer it's output goes from 179 to 0, what I need is a math formula that changes that to a 181 to 360 Is that even possible??
Thanks
Rob
Rob,
You would want to use either (Y=360 then X-Y=Z) or use (X=360 where X-Y=Z).
I don't know what programs you're using, but for the first way (Y=360 then X-Y=Z); whatever is reading the descending of 179 to 0 is the X value, and then it just needs to have the constant of -360 the Y value and that will give the value of Z 181 to 360 in an ascending order. However, you will have a negative value for Z.
The second way is to assign the constant of 360 to X then (X-Y=Z). Thus, your descending values of 179 to 0 would be Y and the Z will be the ascending values 181 to 360.
Example for the first way:
Y=360
X-Y=Z
179-360=-181
178-360=-182
177-360=-183
176-360=-184
on down to
0-360=-360
You would have to include a modifier to change the Z values back to positives.
Example for the second way:
X=360
X-Y=Z
360-179=181
360-178=182
360-177=183
360-176=184
on down to
360-0=360
X is the constant, Y is your descending 179 to 0 and Z will be the ascending 181 to 360. However, the Z values will equal a positive, so no additional modifier...
Please thank Simlady for the math; she is the Wiz Kid!
BSD
Thanks, I figured it out just before bed last night. Take the input x -1 then add 360 That is a programmable formula with no need for tables. ;)
Rob
Hi Rob,
Sorry, I didn't mean tables. I didn't know what program you were using (by the way, what is the program?). So, I just used that to explain it. I assume your using something that reads the inputs like an IO card then an interface like fsuipc or SIOC to program or is it something else?
BSD
I am using SIOC and the analog inputs on a USB servo card. The pot is in the OBS tuning dial on the localizer and glide slpoe indicator I have. Thanks again for the input, to both of you. ;)
Rob