Using serial communication and a CdS cell as a primitive light meter.
/* LightMeter Report the light intensity at an arbitrary scale to the serial port. */ const int inputPin = A0; // use analog 0 (A0) input pin int lightLevel = 0; // used to store the input value void setup() { Serial.begin(9600); // initialize serial communication at 9600 bits/second } void loop() { lightLevel = analogRead(inputPin); // get a reading Serial.println(lightLevel); // print out reading delay(500); // delay between reads }