SQ1 is set to HIGH (5V), and an LED is connected to it. Since SQ1 has a current limiter inside, the LED will not burn out.
On the other side, a phototransistor is connected between SEN and GROUND. When light is incident on the phototransistor, it conducts well, and the value of SEN drops to near zero volts (LOW).
When the pendulum interrupts the LED’s light from falling on the phototransistor, the signal rises to 3.3V (HIGH)
In one oscillation, the pendulum interrupts the light twice, cause two corresponding rising edge signals on SEN. This is measured and treated as the time for a single oscillation.
Using the well known formula for a rod pendulum:
\[T = 2*pi*\frac{2*m*L^2}{3*m*g*L} = 2*pi*\frac{2*L}{3*g}\]We can measure L using a scale, T using expeyes, and calculate the third variable g
.