Download esp32/level1/distance_sensor_basic/src/main_esp.cpp from eunzee/PCEval: direct link, hf CLI and curl.
- Browser
- Download file 478 Bytes
-
https://huggingface.co/datasets/eunzee/PCEval/resolve/main/esp32/level1/distance_sensor_basic/src/main_esp.cpp
- Command line
-
hf download hf://datasets/eunzee/PCEval/esp32/level1/distance_sensor_basic/src/main_esp.cpp
-
curl -L -o main_esp.cpp https://huggingface.co/datasets/eunzee/PCEval/resolve/main/esp32/level1/distance_sensor_basic/src/main_esp.cpp
478 Bytes
| /** | |
| Measure distance with Ultrasonic distance sensor. | |
| 3 APR 2025 by Blind Author | |
| */ | |
| void setup() { | |
| Serial.begin(115200); | |
| pinMode(PIN_TRIG, OUTPUT); | |
| pinMode(PIN_ECHO, INPUT); | |
| } | |
| void loop() { | |
| digitalWrite(PIN_TRIG, HIGH); | |
| delayMicroseconds(10); | |
| digitalWrite(PIN_TRIG, LOW); | |
| int duration = pulseIn(PIN_ECHO, HIGH); | |
| Serial.print("Distance in CM: "); | |
| Serial.println(duration / 58); | |
| delay(500); | |
| } |