const int POT_PIN = A0;
const int LED_PIN = 3;
const int SET_THRESHOLD = 512;
void setup() {
pinMode(LED_PIN, OUTPUT);
}
void loop() {
int analogValue = analogRead(POT_PIN);
if(analogValue > SET_THRESHOLD)
digitalWrite(LED_PIN, HIGH);
else
digitalWrite(LED_PIN, LOW);
}