Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Martinsos/arduino-lib-hc-sr04
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.0.0
Choose a base ref
...
head repository: Martinsos/arduino-lib-hc-sr04
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Aug 21, 2021

  1. Copy the full SHA
    3b217d3 View commit details

Commits on Jan 18, 2022

  1. Update README.md

    Martinsos authored Jan 18, 2022
    Copy the full SHA
    46a8be5 View commit details
Showing with 2 additions and 2 deletions.
  1. +1 −1 README.md
  2. +1 −1 examples/temperature/temperature.ino
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ Besides defining max distance, you can also define max time of measurement (in m
UltraSonicDistanceSensor sensor(triggerPin, echoPin, maxDistanceCm, absoluteTimeout);
```
Then, to measure the distance, you just call `measureDistanceCm()`, which will return distance in centimeters (double). If distance is larger than 400cm, it will return negative value.
Then, to measure the distance, you just call `measureDistanceCm()`, which will return distance in centimeters. If distance is larger than 400cm, it will return negative value.
The calculation assumes a temperature of around 20°C. For improved accuracy you may also provide a temperature yourself, either an average for your location or directly measured from another sensor. The call for a temperature of 3.5°C would as such look like this: `measureDistanceCm(3.5)`.
2 changes: 1 addition & 1 deletion examples/temperature/temperature.ino
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ void loop () {
// Every 1 second, do a measurement using the sensor and print the distance in centimeters.
sens_temperature.requestTemperatures();
float temperature = sens_temperature.getTempCByIndex(0);
double distance = distanceSensor.measureDistanceCm(temperature);
float distance = distanceSensor.measureDistanceCm(temperature);

Serial.print(F("Temperature: "));
Serial.print(temperature);