Need help with using pulseInLong to time a sensor
You cannot use pulseInLong() because it is a blocking function. It
waits until the input rises, then waits until it falls again, and only
then it returns a value. While it's waiting, the rest of the program
cannot run. This means you will not be able to actually generate the
signal you are trying to time.

The easiest solution is to time things yourself with micros(). You
have to implement an edge detector, i.e. some logic that remembers the
previous state of the signal and notices when it changes:

static bool is_high;  // is the input currently HIGH?
static uint32_t time_of_rise;  // when did it rise?

if (!is_high &amp;&amp; signal_1 &gt;= 200) {  // rising edge
    time_of_rise = micros();
    is_high = true;
} else if (is_high &amp;&amp; signal_1 &lt; 200) {  // falling edge
    uint32_t pulse_width = micros() - time_of_rise;
    is_high = false;
    Serial.println(pulse_width);
}