This documentation is out of date.
The new version of the documentation is here: https://cannylogic.com/docs |
Difference between revisions of "Map"
From CANNY Wiki
(Created page with " <div style="float:right;margin:5px;"> {|class="cannytable" width="350px" |- !colspan="2" style="background-color:#AFEEEE;"|Appearance |- |colspan="2" align="center" style="...") |
|||
Line 50: | Line 50: | ||
<div> | <div> | ||
− | + | Re-maps a number from one range to another using '''[https://en.wikipedia.org/wiki/Linear_interpolation linear interpolation]''' method.<br clear="left"> | |
</div> | </div> | ||
<div> | <div> | ||
− | + | For the mathematically inclined, here's the whole formula: | |
[[File:5_10_7_1a.png]] | [[File:5_10_7_1a.png]] | ||
− | + | The Map function block uses integer math so will not generate fractions. Fractional remainders are truncated, and are not rounded or averaged. | |
− | + | If the denominator of a fraction in above formula is zero, the Result is equal to 65535 | |
− | + | Does not constrain values to within the range, because out-of-range values are sometimes intended and useful. | |
</div> | </div> | ||
Line 70: | Line 70: | ||
== Features == | == Features == | ||
− | + | You can use the Map function block to map an analog input value, which ranges from 0 to 4095 to a voltage value, which ranges from 0 - 5000 millivolts. | |
− | + | ||
− | + | ||
== Examples == | == Examples == | ||
{| | {| | ||
|- | |- | ||
− | |[[File:5_10_7_3.png|thumb| | + | |[[File:5_10_7_3.png|thumb|ADC value to millivolts]] |
|} | |} | ||
− | == | + | == See Also == |
[[Converter 8-to-1]] | [[Converter 8-to-1]] | ||
Latest revision as of 17:05, 15 April 2016
Appearance | |
---|---|
Symbol | |
MAP | |
Group | |
Converters | |
Inputs | |
Value: | Integer |
Value from: | Integer |
Value to: | Integer |
Result from: | Integer |
Result to: | Integer |
Outputs | |
Result: | Integer |
Version CANNY Lab | |
from 1.18 |
Re-maps a number from one range to another using linear interpolation method.
For the mathematically inclined, here's the whole formula:
The Map function block uses integer math so will not generate fractions. Fractional remainders are truncated, and are not rounded or averaged.
If the denominator of a fraction in above formula is zero, the Result is equal to 65535
Does not constrain values to within the range, because out-of-range values are sometimes intended and useful.
Features
You can use the Map function block to map an analog input value, which ranges from 0 to 4095 to a voltage value, which ranges from 0 - 5000 millivolts.