In the original sketch there is a piece of code:
emon1.calcVI(20,2000);It looks to me this is a reference to the code below:
void calcVI(int wavelengths, int timeout);
That is the declaration of the method that gets called, yes.
I guess this part means I should be able to call it in a sketch right?
double realPower,
apparentPower,
powerFactor,
Vrms,
Irms;using:
emon1.realPower
emon1.apparentPower
emon1.powerFactor
emon1.Vrms
emon1.IrmsIs this correct or not?
Sorry, no. See that keyword private:? It means that only methods of the class can access that data.
You can add, in the public section, some methods:
double getRealPower();
double getApparentPower();
etc.
Then, in the source code, you implement those methods:
double EnergyMonitor::getRealPower()
{
return realPower;
}
etc.
Or, you can combine the declaration and implementation, in the header file:
double getApparentPower() { return apparentPower; }
etc.