Scale VariableThe scale variable module provides a quick and easy way to convert a single variable from one range to another. This is frequently needed when associating variable values from an input device to an output device that do not share the same value range. For example, the joystick module produces values that range from -1000 to 1000 and but most servo controllers use a range from 0 to 255. You can use this module to convert between the two ranges by specifying the two ranges.
1. Source Variable - The variable that contains the value you want to convert. (Most likely JOY_X in the example above.)
2. Min/Max Value - The expected minimum and maximum value the variable will range between. In the above example this would be -1000 and 1000 respectively. 3. Destination Variable - Where you want the result placed. Note this can be the same variable as the source variable. 4. Min/Max Value - The destination range that you want to convert the value into. In the above example that would be 0 and 255.
NotesThe formula used to perform the conversion is
source_range = source_max - source_min destination_range = destination_max - destination_min destination = (((source - source_min) * destination_range) / source_range) + destination_min;
Click Here to download a robofile that shows how to use the Scale Variable module inbetween a joystick and SSC module.
| New Post
|Scale_Variable Related Forum Posts||Last post||Posts||Views|
scale servo arduino object tracking
I have a problem with the tracking object. the servos dont work good. the servos are moving for every side. I think that is prob...
Sparkfun-Arduino servo control not working
Hi I just downloaded roborealm and am having trouble interfacing to an arduino board. I simply want...
mini maestro problem
I am using a pololu mini maestro 12. whenever I launch my roborealm software, it recognizes my camera without a problem, but whe...