1void loop() {
2 val = analogRead(potPin); // read the value from the sensor
3 digitalWrite(ledPin, HIGH); // turn the ledPin on
4 delay(val); // stop the program for some time
5 digitalWrite(ledPin, LOW); // turn the ledPin off
6 delay(val); // stop the program for some time
7}