scaling a range of numbers to another range

hey, i have an embarrassingly simple math question to ask but i just cant remember the answer. i'm trying to grab a value from an analog pin (values from 0 - 1024) and convert it to use with a servo motor (ranges from 0 - 180).

basically i need a function to write to the analog pin that will be between 0-180, or some keywords to type in google to find it. everything i'm trying to google is bringing up way too much non-related info.

thanks for the help!

You want the map function: http://arduino.cc/en/Reference/Map

1 Like

awesome. thanks much.

back to work!