you have one degree on freedom which is $~S~$

from the constraint equation

$$ h^2+\left(\frac S2\right)^2=\left(\frac l2\right)^2\tag 1$$

you obtain

$$h=h(S)=\frac 12\sqrt{l^2-S^2}$$

thus
$$\dot h=\frac{\partial h}{\partial S}\,\dot S=
-\frac 12\,{\frac {S}{\sqrt {{l}^{2}-{S}^{2}}}}\,\dot S$$

with 
$$\dot S=f(t)\quad ,S(t)=\int f(t)\,dt+S_0$$

and   $~S_0=\frac l2\,\cos(\theta)~$ 

you can obtain   the velocity $~\dot h(t)~$ and the position $~h(t)=\int \dot h\,dt$

**Notice**

$~S(t)\le l$