  The authors study the problem $u_t=u_{xx},\ 0<x<1,\ t>0; \ u(x,0)=0,$ and
$u(0,t)=u(1,t)=\psi(t),$ where $\psi(t)=u_0$ for $t_{2k} < t<t_{2k+1}$ and
$\psi(t)=0$ for $t_{2k+1} <t<t_{2k+2},\ k=0,1,2,\ldots$ with $t_0=0$ and the
sequence $t_{k}$ is determined by the equations $\int_0^1 u(x,t_k)dx = M,$ for
$k=1,3,5,\dots,$ and $\int_0^1 u(x,t_k)dx = m,$ for $k=2,4,6,\dots$ and where
$0<m<M<u_0$. Note that the switching points $t_k,\quad k=1,2,3,\ldots$ are
unknown. Existence and uniqueness are demonstrated. Theoretical estimates of
the $t_k$ and $t_{k+1}-t_k$ are obtained and numerical verifications of the
estimates are presented.
