MPPT arduino

Hello everyone! I'm working on a Maximum power point charger with arduino and I have a problem.
How do I stop battery from charging (Vin) for 4-5 seconds... in that time I need to read the Voltage on the battery.
Could anyone give me an example of code, please!

z = analogRead(V_battery);
analogWrite(V_battery, A2);
Serial.println((z*5)/1023);
delay(10);

What has that code snippet go to do with charging a battery?

My guess (without seeing any code) is that whatever the code is doing to charge the battery you stop it doing that for 4-5 seconds and take a reading.