How can I read values at a sampling rate and keep them in a vector?

Hi!

I'm working on a IoT application about monitoring electrical consumption of a home.

I'm using a ZMPT101B sensor to read the voltage and ASC712 for the current. I know how to read the values from the sensor and scale it. But I need help to do the next:

I think I have to take values from the sensors in a sampling rate (I don't know which to establish), and keep that values on a vector (one for the voltage and other for the current). After that I would calculate the RMS value of both signals, potency, consumption...

Would someone help me?

Thank you so much!

instead of capturing the samples, why not sum the squares of the sample which afterwards you calculate the square root?

There is lots of great advice, circuitry and Arduino code at https://openenergymonitor.org/