A friend who is a proper C programmer (as opposed to a newbie to C++ like me) gave me a tiny bit of code which includes
#include
#include
but they seem to throw up an error when compiling.
compilation terminated
exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.
I commented out sections of the code bit by and traced it down to these two include statements as the problem.
Now he probably wrote it up in C++ or C# so the Arduino IDE may not have the necessary libraries included.
However I have used "map" in other code before in the Arduino IDE and it works, so I am not sure what the difference is between the map that is obviously included, and the #include
My code that has worked
turn = map(ch1,1035,1835,-255,255);
his code seems a little more complex like it is trying to retrieve a value from a remote call. (his looks like Spanish to me at the moment)
std::map<int, int> curveVals = {{ 0, 0}, {10, 1}, {15, 2}, {25, 3}, {35, 4}, {45, 5}, {55, 6}, {65, 7}, {75, 8}, {85, 9}, {95, 10}, {105, 12}, {115, 15},
{125, 18}, {135, 21}, {145, 24}, {155, 27}, {165, 30}, {175, 34}, {185, 39}, {195, 45}, {205, 52}, {215, 61}, {225, 72}, {235, 85}, {245, 100}, {256, 0}}};
I put this error down to me needing to add #include and #include libraries to Arduino IDE
are these already in the Arduino IDE under another include or do I need to add them?
I have looked at https://www.arduino.cc/en/Reference/Libraries / https://www.arduino.cc/en/Guide/Libraries and a few other things that say how to add libraries, but it would seem to me something so common as map and string should already be included, and if they aren't I don't know where to get them.