const int ledPin1 = 8; // setup pin numbers const int ledPin2 = 7; const int ldrPin = 3; const int buttonPin = 2; int buttonState = 0; // variable for reading the pushbutton status void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode (ledPin1, OUTPUT); // initialize LED1 as an output pinMode (ledPin2, OUTPUT); // initialize LED2 as an output pinMode (ldrPin, INPUT); // initialize LDR as an input pinMode (buttonPin, INPUT_PULLUP); // initialize button as an input } void loop() { int ldrStatus = analogRead (ldrPin); // read LDR value if (ldrStatus >=500) { // if the value is higher than 500, LED is off digitalWrite (ledPin1, LOW); Serial.println("it's bright"); } else { // if the value is lower than 500 , LED is on digitalWrite (ledPin1, HIGH); }; // read the state of the pushbutton value: buttonState = digitalRead(buttonPin); // check if the pushbutton is pressed. If it is, the buttonState is HIGH: if (buttonState == HIGH) { // turn LED on: digitalWrite(ledPin2, HIGH); } else { // turn LED off: digitalWrite(ledPin2, LOW); } }