https://github.com/mryslab/nanoconnecthcsr04
Arduino Nano RP2040 Connect PIO-based library for the HCSR04 Ultrasonic Distance Sensor.
https://github.com/mryslab/nanoconnecthcsr04
Last synced: about 1 year ago
JSON representation
Arduino Nano RP2040 Connect PIO-based library for the HCSR04 Ultrasonic Distance Sensor.
- Host: GitHub
- URL: https://github.com/mryslab/nanoconnecthcsr04
- Owner: MrYsLab
- License: agpl-3.0
- Created: 2021-07-24T15:11:14.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-03-13T21:04:37.000Z (over 4 years ago)
- Last Synced: 2025-04-14T22:55:52.601Z (about 1 year ago)
- Language: C++
- Homepage:
- Size: 17.6 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NanoConnectHcSr04
## An Arduino Nano RP2040 Connect library for HC-SR04 type ultrasonic distance sensors.
## It is implemented using the RP2040 PIO processor.
Here is a sample sketch that continuously reads and prints distances:
```asm
#include
// D11 (7) == trigger, D12 (4) == echo
// Using pio0 and sm 0
NanoConnectHcSr04 sonar(7,4, pio0, 0);
// distance value returned
float value = 0.0;
void setup() {
Serial.begin(115200);
}
void loop() {
// put your main code here, to run repeatedly:
value = sonar.readSonar();
Serial.println(value);
}
```