AVR 36 us
| 48 | |
| 49 | // AVR 36 us |
| 50 | float map(float value) |
| 51 | { |
| 52 | // add next line if most values are in range. |
| 53 | // if ((_minimum <= value) && (value < _maximum)) return value; |
| 54 | float mm = fmod((value - _minimum), _range) + _minimum; |
| 55 | if (mm < _minimum) mm += _range; // catch rounding errors |
| 56 | return mm; |
| 57 | } |
| 58 | |
| 59 | // Think of it as how many rotations must a hoist make to free a rope of given length. |
| 60 | // Or how many rotations a cylinder has to make to roll up a rope of given length. |