|
Download esp32/level2/button_duration/description_esp.md from eunzee/PCEval: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/datasets/eunzee/PCEval/resolve/main/esp32/level2/button_duration/description_esp.md
- Command line
-
hf download hf://datasets/eunzee/PCEval/esp32/level2/button_duration/description_esp.md
-
curl -L -o description_esp.md https://huggingface.co/datasets/eunzee/PCEval/resolve/main/esp32/level2/button_duration/description_esp.md
1.34 kB
Button Duration
Project Description
This is an ESP32 project that determines how long a switch is pressed
Hardware Components
- ESP32 DevKit v1
- 10kΩ resistor
- Push Button
Circuit Description
Circuit is designed to use a pull-up resistor. When the button is not pressed, the pin4 pin is connected to 3V3 through a 10kΩ resistor. When the button is pressed, the pin4 pin is connected to gnd2.
Expected Behavior
When the ESP32 powers up, it should:
- Initialize serial communication
- Configure the specified button pin as INPUT
- Continuously monitor the button state and measure how long it is pressed
- Print the duration in second, in the following format: "Button pressed duration: {duration}s"
Success Criteria
The test is successful when:
- The pressed duration in seconds is correctly printed in the given format
Notes for Implementation
- Use Arduino.h library for arduino core.
- Include a short delay in the loop to handle switch bouncing
- When the button is not pressed, pin1.l is connected to pin1.r and pin2.l is connected to pin2.r. When the button is pressed, all the pins are connected together.
Variants
This project may have different variants with the pushbutton connected to different pins.
Attributes
- To use 10kΩ resistor, set the property name "value" to "10000 ohm".