Here is a sample sketch that continuously reads and prints distances:
#include <NanoConnectHcSr04.h>
// 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);
}