// Testing the MultiMap library
// https://github.com/RobTillaart/MultiMap
// This Wokwi project: https://wokwi.com/projects/401812192306752513
//
// A tab between x and y, with a linefeed
// at the end of a line, works for the
// website: https://quickplotter.com/
#include <MultiMap.h>
// I tried with integers and with float.
// input values
float input[6] = { 0.0, 20.0, 40.0, 60.0, 80.0, 100.0};
// corresponding output values
float output[6] = { 1.0, 2.0, 4.5, 12.0, 33.0, 100.0};
void setup()
{
Serial.begin(115200);
for(float x=0.0; x<=100.0; x+=2.0)
{
float y = multiMap<float>(x, input, output, 6);
Serial.print(x);
Serial.print("\t");
Serial.print(y);
Serial.println();
}
}
void loop()
{
delay(10);
}
/*
// input values
int input[6] = { 0, 20, 40, 60, 80, 100};
// corresponding output values
int output[6] = { 1, 2, 4, 12, 33, 100};
void setup()
{
Serial.begin(115200);
for(int x=0; x<=100; x+=2)
{
int y = multiMap<int>(x, input, output, 6);
Serial.print(x);
Serial.print("\t");
Serial.print(y);
Serial.println();
}
}
void loop()
{
delay(10);
}
*/