RC Integrator mean value
You are generating an input waveform to the integrator that has two components.
We might describe it as a rectangular wave between 0 and (I'm guessing) +5V.


It has a DC component - its mean value.
It has an AC component that has a +ve peak and a -ve peak.


Your integrator equation doesn't apply to the DC component because its frequency is zero, which is below the required frequency for "integration" operation. This DC component passes through the integrator unmolested.

Only the AC component is integrated, because its frequency components are at (or even better, above) the required frequency for "integration" operation.