const int ledPin = 0;
const int buttonPin = 1;
int buttonState = 0;
int lastButtonState = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("System On");
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT_PULLUP);
}
void loop() {
turnOnLEDOnButtonPress();
}
void turnOnLEDOnButtonPress() {
// Read the current state of the button
buttonState = digitalRead(buttonPin);
// If the button state has changed
// if (buttonState != lastButtonState) {
// // Print the new state
// if (buttonState == LOW) {
// Serial.println("Button pressed");
// Serial.println(buttonState);
// digitalWrite(ledPin, HIGH);
// } else {
// Serial.println("Button released");
// Serial.println(buttonState);
// digitalWrite(ledPin, LOW);
// }
// // Update the last button state
// lastButtonState = buttonState;
// // Small delay to debounce the button
// delay(50);
// }
}