Programming The program below uses the Light sensor to control the LED. As the picture shows above, the Light sensor is connected to analog port 0 and the LED is connected to port 12. The resistance of the photoresistor which stands for light value can be calculated based on the voltage obtained through the analog port. Then you can use this data to control the LED or other thing you like. #include "math.h" const int ledPin=12; //Connect the LED electronic brick module to Iteaduino D12 const int thresholdvalue=10; //The treshold for which the LED should turn on. Setting it lower will make it go on at more light, higher for more darkness void setup() { Serial.begin(9600); //Start the Serial connection pinMode(ledPin,OUTPUT); //Set the LED on Digital 12 as an OUTPUT } void loop() { int sensorValue = analogRead(0); float Rsensor; Rsensor=(float)(1023-sensorValue)*10/sensorValue; if(Rsensor>thresholdvalue) { digitalWrite(ledPin,HIGH); } else { digitalWrite(ledPin,LOW); } Serial.println(Rsensor,DEC); }