Skip to content

Commit 8123b93

Browse files
authored
Merge pull request #704 from srobo/ultrasound-fix
Fix ultrasound pulse measurement overflowing at long distance
2 parents b63ad2b + dcc0d4d commit 8123b93

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

resources/kit/arduino-fw.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// We communicate with the Arduino at 115200 baud.
44
#define SERIAL_BAUD 115200
55

6-
#define FW_VER 2
6+
#define FW_VER 3
77

88
void setup() {
99
Serial.begin(SERIAL_BAUD);
@@ -61,7 +61,7 @@ void command_ultrasound() {
6161
digitalWrite(pulse, LOW);
6262

6363
// measure the echo time on the echo pin
64-
int duration = pulseIn(echo, HIGH, 60000);
64+
long duration = pulseIn(echo, HIGH, 60000);
6565
Serial.print(microsecondsToMm(duration));
6666
}
6767

0 commit comments

Comments
 (0)