Scale function in Spin
jdolecki
Posts: 726
Arduino has a scale function to scale data
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
How do i do this in spin?
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
How do i do this in spin?
Comments
If you assume that the minimum of the ranges are always 0 then you can simplify: