Rename a commend

hello,

Can someone tell me how I can rename a command? I would like to change the name of the map instruction or a little program that does the same is also good.

thanks in advantage

Why do you want to change the name ?

Because it's a task for school and I don't know how to do.

Have you tried the pre processor?

Write your own function which does the same thing, you can call it whatever you like.

how do I do that because I just started with Arduino and I don't know already everything

Have a look at this link.

AWOL’s reply makes me wonder: if I use a preprocessor #define in the sketch to change the name “map,” will it affect the relevant library/included files as well as the sketch itself?

–Michael

mjward:
AWOL's reply makes me wonder: if I use a preprocessor #define in the sketch to change the name "map," will it affect the relevant library/included files as well as the sketch itself?

--Michael

Well, you have an Arduino, the IDE, libraries and files that you can #include so you could try it and see I suppose.

If you look in WMath.cpp, which is part of the Arduino installation, you will find the source for the map function.

long map(long x, long in_min, long in_max, long out_min, long out_max)
{
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

Feel free to borrow the code for your own version of the function with any reasonable name of your choice.

UKHeliBob:
Well, you have an Arduino, the IDE, libraries and files that you can #include so you could try it and see I suppose.

Yes, but that's not the lazy way to do it.

--Michael