PComp - Lab 2
Since a potentiometer is just a variable resistor, you connect power and ground, and the third pin is the set voltage. I inserted the variable voltage into an analog input on the Arduino, which is read in as a value from 0-1023. I set a series of conditions that would check the voltage, and change brightness of two LEDs.
Here are the settings I used:
if (potPos < 300 && potPos > 100) //potPos is the value of the potentiometer
analogWrite(ledYlw, 125); //half brightness
analogWrite(ledRed, 0); //off
else if (potPos > 300 && potPos < 800)
else if (potPos > 800)