/*Create a circuit using slide potentiometer,LED.
1.Connect Slide potentiometer VCC terminal to arduino 5v pin in red color.
2.Connect SIG terminal of Slide Potentiometer to A2 Analog pin in green color.
3.Connect GND terminal of Slide Potentiometer to GND Pin in black color.
4.Connect C terminal of LED to Ground and terminal A of LED to pin 6 in black and red color respectively.*/
void setup() {
pinMode(6, OUTPUT);
pinMode(A2, INPUT);
}
int readPot(int pin) {
return map(analogRead(pin), 0, 1023, 0, 255);
}
void loop() {
analogWrite(6, readPot(A2));
}