int potpin = 0;
int pin = 11;
int val;
void setup() {
// put your setup code here, to run once:
pinMode(pin, OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
val= analogRead(potpin);
val=map(val,0,1023,0,11);
Serial.println(val);
digitalWrite(pin,val);
delay(15);
}