pulseIn(pin, value)
Reads a pulse (either HIGH or LOW) on a pin. For example, if value is HIGH, pulseIn() waits for the pin to go from LOW to HIGH, starts timing, then waits for the pin to go LOW and stops timing. Returns the length of the pulse in microseconds.
Reference: https://www.arduino.cc/reference/en/language/functions/advanced-io/pulsein/