Skip to content

Instantly share code, notes, and snippets.

@sdrshnptl
Forked from nadavmatalon/mapf.ino
Created January 12, 2021 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sdrshnptl/f7889ebc5f7e2a19d1ed6cc5a813822c to your computer and use it in GitHub Desktop.
Save sdrshnptl/f7889ebc5f7e2a19d1ed6cc5a813822c to your computer and use it in GitHub Desktop.
ARDUINO: MAP FLOAT FUNCTION
double mapf(double val, double in_min, double in_max, double out_min, double out_max) {
return (val - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment