Measuring AC Current and Voltage with ACS712 and Arduino Nano

This is my first post, so I hope it is in the correct place. I have been attempting to measure the AC current and voltage from a 350 V and 30 A line using an ACS712 and arduino nano. I was able to get decently accurate results when measuring DC. I understand for AC, I need to use some sort of sampling and RMS conversion. However, my implementation must be incorrect as I am not getting accurate current readings. Do I need to sample at 1/60 Hz intervals?

My first code attempt for AC current only:

float samplesnum = 1000;
float adc_zero = 510; //relative digital zero of the arudino input from ACS712
long currentacc = 0;
long currentac = 0;
long adc_raw = 0;
long currentAD = 0;

void setup()
{
  Serial.begin(9600);
}
void loop()
{
  
  for(int i=0; i<samplesnum; i++) 
  {  
  adc_raw = analogRead(3);
  currentacc += (adc_raw - adc_zero) * (adc_raw - adc_zero);  //rms
  }
  currentAD = (currentacc * 75.7576)/ 1024; //D to A conversion
  currentac = sqrt(currentAD)/samplesnum; //rms
  Serial.println(currentac);
}

Second attempt:

float c_val = 0;
float volts = 0;
float val = 0;

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  c_val = 511 - analogRead(3);
  val = analogRead(4);
  float c_average = 0;
  float v_average = 0;
  float currentAC = 0;
  float amps = 0;
  
  
  for(int i = 0; i<100; i++)
  {
  
    c_average += sq(amps) / 100;//rms conversion
    currentAC = sqrt(c_average);
    
  for(int i = 0; i <1000; i++)
  {
    volts = val * (5.0 / 1024.0);
    amps = amps + ((c_val * 75.7576)/ 1024 / 1000);//averaging samples and D to A conversion
    v_average = (v_average + volts) / 1000; 
  }  
  }
    
  Serial.println(currentAC);
  Serial.println(v_average);
}

The 75.7576 for the conversion comes from solving for X, 5 V / X = .066 V / 1 A from the arduino max analog input voltage and the ACS712 sensitivity on the spec sheet respectively. Any help would be greatly appreciated.