Map Function Arduino Code Example


Example 1: map arduino

Syntax map(value, fromLow, fromHigh, toLow, toHigh)  Parameters value: the number to map. fromLow: the lower bound of the value’s current range. fromHigh: the upper bound of the value’s current range. toLow: the lower bound of the value’s target range. toHigh: the upper bound of the value’s target range.    Example: map(val, 0, 255, 0, 1023);

Example 2: arduino map function

long map(long x, long in_min, long in_max, long out_min, long out_max)  {   return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; }

Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?