GroveStreams

MAP like derivation function485

Avocadodude private msg quote post Address this user
In a derived stream is there a way to map values. In Arduino case it would be something like:
val = map(val, 0, 1023, 0, 255);
I suppose I can just write the math function, just seeing if I missed something in the deviation functions.
Post 1 IP   flag post
MikeMills private msg quote post Address this user
Never heard of that function. From the arduino site I found out it is doing this:

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;
}


Do you think this is a common function and would be worth adding to our derivation library?
Post 2 IP   flag post
Avocadodude private msg quote post Address this user
Sorry, farm happened at I lost track of this. For me it's fairly common, mapping pressure transducer output to PSI. Not to sound selfish...
Post 3 IP   flag post
2968 3 3
Log in or sign up to compose a reply.