Download esp32/level3/button_led/src/main_esp.cpp from eunzee/PCEval: direct link, hf CLI and curl.
- Browser
- Download file 476 Bytes
-
https://huggingface.co/datasets/eunzee/PCEval/resolve/main/esp32/level3/button_led/src/main_esp.cpp
- Command line
-
hf download hf://datasets/eunzee/PCEval/esp32/level3/button_led/src/main_esp.cpp
-
curl -L -o main_esp.cpp https://huggingface.co/datasets/eunzee/PCEval/resolve/main/esp32/level3/button_led/src/main_esp.cpp
476 Bytes
| /** | |
| Press the button to turn on the LED | |
| 31 Mar 2025 by Blind Author | |
| */ | |
| const int BUTTON_PIN = 2; | |
| const int LED_PIN = 13; | |
| void setup() { | |
| Serial.begin(9600); | |
| Serial.println("Button LED test starts"); | |
| pinMode(BUTTON_PIN, INPUT_PULLUP); | |
| pinMode(LED_PIN, OUTPUT); | |
| } | |
| void loop() { | |
| int buttonState = digitalRead(BUTTON_PIN); | |
| if (buttonState == LOW) { | |
| digitalWrite(LED_PIN, HIGH); | |
| } | |
| else { | |
| digitalWrite(LED_PIN, LOW); | |
| } | |
| } |