int potpin=15;
int ledpin=5;
void setup() {
// initialize digital pin LED_BUILTIN as an output.
Serial.begin(9600);
pinMode(12,INPUT);
pinMode(21,OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
int val=analogRead(12);
digitalWrite(21, HIGH); // turn the LED on (HIGH is the voltage level)
delay(val); // wait for a second
digitalWrite(21, LOW); // turn the LED off by making the voltage LOW
delay(val);
Serial.println(val); // wait for a second
}