2014-11-02 16:20:21 -05:00
|
|
|
// FILE: fastMapDemo3.ino
|
|
|
|
// AUTHOR: Rob Tillaart
|
|
|
|
// PURPOSE: demo of FastMap class ==> a faster map function
|
|
|
|
// DATE: 2014-11-02
|
2020-11-27 05:16:22 -05:00
|
|
|
// URL: https://github.com/RobTillaart/FastMap
|
|
|
|
// http://forum.arduino.cc/index.php?topic=276194
|
2014-11-02 16:20:21 -05:00
|
|
|
|
2021-12-17 08:46:34 -05:00
|
|
|
|
2014-11-02 16:20:21 -05:00
|
|
|
#include "FastMap.h"
|
|
|
|
|
|
|
|
FastMap CtoF;
|
|
|
|
|
2021-12-17 08:46:34 -05:00
|
|
|
|
2014-11-02 16:20:21 -05:00
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
Serial.begin(115200);
|
|
|
|
Serial.print("Start fastMapDemo3\nlib version: ");
|
|
|
|
Serial.println(FASTMAP_LIB_VERSION);
|
|
|
|
Serial.println();
|
|
|
|
|
|
|
|
CtoF.init(0, 100, 32, 212);
|
|
|
|
|
|
|
|
float f = CtoF.map(163);
|
|
|
|
Serial.print(f);
|
|
|
|
Serial.print(char(176));
|
|
|
|
Serial.println('F');
|
|
|
|
|
|
|
|
float c = CtoF.back(f);
|
|
|
|
Serial.print(c);
|
|
|
|
Serial.print(char(176));
|
|
|
|
Serial.println('C');
|
|
|
|
|
2017-07-15 12:28:01 -04:00
|
|
|
f = CtoF.upperConstrainedMap(163);
|
2014-11-02 16:20:21 -05:00
|
|
|
Serial.print(f);
|
|
|
|
Serial.print(char(176));
|
|
|
|
Serial.println('F');
|
|
|
|
|
2017-07-15 12:28:01 -04:00
|
|
|
f = CtoF.lowerConstrainedMap(163);
|
|
|
|
Serial.print(f);
|
2014-11-02 16:20:21 -05:00
|
|
|
Serial.print(char(176));
|
|
|
|
Serial.println('C');
|
|
|
|
}
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
}
|
2021-12-17 08:46:34 -05:00
|
|
|
|
|
|
|
|
|
|
|
// -- END OF FILE --
|
|
|
|
|