So if I have a range of numbers \'0 - 1024\' and I want to bring them into \'0 - 255\', the maths would dictate to divide the input by the maximum the input will be (1024 in
n / 1024 is integer division, which yields an integer (ie. 0 in this case).
Use n / 1024.0 instead.
n / 1024.0