/*www.theorycircuit.com*/ int ledPin = 3; int photocell = 0; void setup() { pinMode(ledPin, OUTPUT); Serial.begin(9600); } void loop() { photocell = (analogRead(0)/4); // Divides input 0-1023 to resemble to 0-255 analogWrite(ledPin, photocell); Serial.print(photocell); // The delay can be change to get the desired dimming effect delay(20); }