ErickSimoes / Ultrasonic

Minimalist library for Ultrasonic Module HC-SR04, PING))) and Seeed SEN136B5B to Arduino
MIT License
137 stars 65 forks source link

Feature: add timeout without pulseIn #48

Closed OtacilioN closed 6 years ago

OtacilioN commented 6 years ago

Summary

Add timeout feature without using pulseIn timeout function, completing the removal of the pulseIn function, it fixes #45

Description of the Change

add an and verification in the while that waits for the pulse get back to also verify if the current time is lowest or equal to the timeout

Benefits

Now is fully compatible with pulseIn but also compatible with platforms that pulseIn does not works

ErickSimoes commented 6 years ago

Hi @OtacilioN, thank you for your contribution 👍

Would not it be nice to do the same timeout check in a first while?

OtacilioN commented 6 years ago

RIght @ErickSimoes add in the first while too!

ErickSimoes commented 6 years ago

Very good! It was wonderful, thank you! ❤️