How To Use Map Function In 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

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable