Let's Make Robots!

converting values. arduino #solved#

So here is the question in short.

Im using a arduino uno and have analog readings filtered to 0 to 50, i want to convert those values to 50 to 0 insted.

This is probably realy simple but my head is blank.

more detailed description is that i want to take the distance reading and make a speaker bep more frequently the closer the robot comes to something, brings back old videogame memmories.

A spekar is hooked up to digitalpin 3 and i have some code that beeps but i get stuck at making the beeps more frequent and  not longer...