Take a look at the state change example in the IDE.
When the pin goes from LOW to HIGH, take the value of millis (or micros).
When the pin goes from HIGH to LOW, take the time again and calculate the HIGH time.
Sum this.
Take a look at the state change example in the IDE.
When the pin goes from LOW to HIGH, take the value of millis (or micros).
When the pin goes from HIGH to LOW, take the time again and calculate the HIGH time.
Sum this.