Hi i have some question about Emonlib!!

Is there anyone who can help me?

im trying to measure CT currents with Arduino.

so im studyng Emonlib now, but i cant understand well…

could you tell me somethings??

In Emonlib code

Line number142 ~ 147

lastVCross = checkVCross;

if (sampleV > startV) checkVCross = true;

else checkVCross = false;

if (numberOfSamples==1) lastVCross = checkVCross;

```
if (lastVCross != checkVCross) crossCount++;
```

i cant understand what is this means for

and

line number 185 ~ 198

or (unsigned int n = 0; n < Number_of_Samples; n++)

{

sampleI = analogRead(inPinI);

```
// Digital low pass filter extracts the 2.5 V or 1.65 V dc offset,
// then subtract this - signal is now centered on 0 counts.
offsetI = (offsetI + (sampleI-offsetI)/1024);
filteredI = sampleI - offsetI;
// Root-mean-square method current
// 1) square current values
sqI = filteredI * filteredI;
// 2) sum
sumI += sqI;
```

}

double I_RATIO = ICAL *((SupplyVoltage/1000.0) / (ADC_COUNTS));

Irms = I_RATIO * sqrt(sumI / Number_of_Samples);

//Reset accumulators

sumI = 0;

//--------------------------------------------------------------------------------------

return Irms;

why we need to do it again??

i think we already solve Vrms, Irms in line156~160

and…in line 201~202

is it okay we dont need to get Vrms???

i wll be really appreciate if somebody help me