ACS712 AC mA Current Sensor Sketch - Required

I need a code that works! A simple explanation of the math would also be beneficial for me and others that need a similar solution. Please and thank you.

Hardware:
Arduino Uno R3
-ATMEGA328P-PU micro-processor
-Arduino IDE 1.6.5-R5
Sparkfun Low Current Sensor Breakout - ACS712 (+5A to -5A)
-this sensor has adjustable pots to calibrate Vref and Gain
-Vref calibrated with meter to 2.5VDC
-Gain needs to be calibrated (but I need a reliable code to validate readings)

Need to measure:
0.1A to 0.25A (100mA to 250mA)
5 VDC supply power to ACS712 sensor
12 VAC “high side” test circuit voltage with fixed .2A current

Require:
Arduino Sketch/Code to read mA current value through the ACS712 (+5A to -5A) sensor

Code Example - this code does not seem to work
I have reviewed a number of posts on forum and web. There are lots of partial and missing leading information that simply does not work. Understandably, the code to read AC current is more complex than that to read DC current.

This is the sample code that I have tried. The values change as current is switched on/off but the values do not seem correct.

#define CURRENT_SENSOR A0 // Analog input pin that sensor is attached to
 
float amplitude_current;     //amplitude current
float effective_value;       //effective current 
 
void setup() 
{
    Serial.begin(115200); 
    pins_init();
}
void loop() 
{
    int sensor_max;
    sensor_max = getMaxValue();
    Serial.print("sensor_max = ");
    Serial.println(sensor_max);
    //the VCC on the Grove interface of the sensor is 5v
    amplitude_current=(float)(sensor_max-512)/1024*5/185*1000000;// for 5A mode,you need to modify this with 20 A and 30A mode; 
    effective_value=amplitude_current/1.414;
    //minimum_current=1/1024*5/185*1000000/1.414=18.7(mA)
    //Only for sinusoidal alternating current
    Serial.println("The amplitude of the current is(in mA)");
    Serial.println(amplitude_current,1);//Only one number after the decimal point
    Serial.println("The effective value of the current is(in mA)");
    Serial.println(effective_value,1);
}
void pins_init()
{
    pinMode(CURRENT_SENSOR, INPUT);
}
/*Function: Sample for 1000ms and get the maximum value from the S pin*/
int getMaxValue()
{
    int sensorValue;             //value read from the sensor
    int sensorMax = 0;
    uint32_t start_time = millis();
    while((millis()-start_time) < 1000)//sample for 1000ms
    {
        sensorValue = analogRead(CURRENT_SENSOR);
        if (sensorValue > sensorMax) 
        {
            /*record the maximum sensor value*/
            sensorMax = sensorValue;
        }
    }
    return sensorMax;
}