int LDRSensor = A1; int led =0; // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(led, OUTPUT); pinMode(LDRSensor, INPUT); } // the loop function runs over and over again forever void loop() { int LDRval = analogRead(LDRSensor); float ldr = LDRval * (100.0 / 1023.0); if ( ldr >= 70 ) { digitalWrite(led, LOW); // turn the LED on (HIGH is the voltage level) } else { digitalWrite(led, HIGH); // turn the LED off by making the voltage LOW } }