Skip to content

Instantly share code, notes, and snippets.

@maxpromer
Created March 18, 2017 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxpromer/dfcce74f13b8914bc9422b5c989415b1 to your computer and use it in GitHub Desktop.
Save maxpromer/dfcce74f13b8914bc9422b5c989415b1 to your computer and use it in GitHub Desktop.
unsigned long __pulseIn(int pin, int lavel) {
while(digitalRead(pin) != lavel) ;
unsigned long time_s = 0;
while(digitalRead(pin) == lavel) {
delayMicroseconds(1);
time_s++;
}
return time_s;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment