TDuino
Convenient functionality for Arduino
|
Functions | |
int | TL_MapToInt (float progress, int low, int high) |
Map to int. | |
unsigned int | TL_MapToUInt (float progress, unsigned int low, unsigned int high) |
Map to unsigned int. | |
long | TL_MapToLong (float progress, long low, long high) |
Map to long. | |
unsigned long | TL_MapToULong (float progress, unsigned long low, unsigned long high) |
Map to unsigned long. | |
float | TL_MapToFloat (float progress, float low, float high) |
Map to float. | |
These functions will help you to convert the progress value passed to the timeline callback to numeric values of different types. All functions takes these three arguments:
progress The float passed to the callback. min The minimum value it should be mapped to. max The maximum value it should be mapped to.
The formula is pretty simple: roundf((float)(max - min) * progress) + min
The are functions for signed and unsigned int + long and for float: