pinMode(9, OUTPUT); for(;;) { if (analogRead(0)>500) { digitalWrite(9, HIGH); } else { digitalWrite(9, LOW); } }