const int sensorPin = 32; // the number of the pushbutton pin
const int ledRed= 27;
const int ledGreen= 33; // the number of the LED pin
// variable for storing the pushbutton status
int buttonState = 0;
void setup() {
Serial.begin(115200);
// initialize the pushbutton pin as an input
pinMode(sensorPin, INPUT);
pinMode(ledRed, OUTPUT);
pinMode(ledGreen, OUTPUT);
// initialize the LED pin as an output
//pinMode(ledPin, OUTPUT);
}
void loop() {
// read the state of the pushbutton value
buttonState = digitalRead(sensorPin);
delay(1000);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH
if (buttonState == HIGH) {
digitalWrite(ledRed, HIGH);
digitalWrite(ledGreen, HIGH);
// turn LED on
Serial.println("Dark");
//digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledGreen, HIGH);
digitalWrite(ledRed, LOW);
// turn LED off
Serial.println("Bright");
//digitalWrite(ledPin, LOW);
}
}