int sensorPin = 7; /* select the input pin for LDR */ int sensorValue = 0; /* variable to store the value coming from the sensor */ int LEDPin = 3; void setup(void) { pinMode(sensorPin, INPUT); pinMode(LEDPin, OUTPUT); } void loop(void) { sensorValue = analogRead(sensorPin); //Read data from analog pin and store it to value variable // Mapping values of photoresistor to light of LED sensorValue = map(sensorValue,200,400,0,255); analogWrite(LEDPin, sensorValue); delay(1000); }