Control the position of a servo using a potentiometer and the built in Arduino example. Also, adjust the example code to work with a new circuit.
The servo knob sketch uses the map(value, fromLow, fromHigh, toLow, toHigh)
function that we saw briefly in the sensor-driven-led exercise. This function takes
a value within a certain range and maps it onto a different range. For example, the ADC on
the Arduino Uno gives a value from 0 to 1023. If I wanted to display that on a 10 segment
bar graph LED, I could use the statement:
height = map(sensorVal, 0, 1023, 0, 10);
to find out how high the bar graph should be.
constrain()
function in the Arduino reference.