const byte analogInPin = A0; // Analog input pin that the potentiometer is attached to
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}
void loop() {
Serial.print("sensor = ");
Serial.print(analogRead(analogInPin));
// wait 2 milliseconds before the next loop for the analog-to-digital
// converter to settle after the last reading:
delay(2);
}
If your photoresistor is connected to a different analog pin you just need to change the definition of analogInPin.