Closed FlorianPoot closed 5 years ago
Is the function map_value() from m5stack.py working ?
Maybe I'm using it badly but it always give me incorrect number.
Ex: map_value(value, 3000, 4100, 0, 6) return always 6 independently of value.
Here is a function that I think is more correct
def map_value(x, in_min, in_max, out_min, out_max): return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
You are right...
Is the function map_value() from m5stack.py working ?
Maybe I'm using it badly but it always give me incorrect number.
Ex: map_value(value, 3000, 4100, 0, 6) return always 6 independently of value.
Here is a function that I think is more correct