Dear all,
I want to get the addition of the each arduino serial print data values and print it again as the sum.
i try to calculate watt- second value using following library and for this purpose has to add each serial print data from serial printer.
// EmonLibrary examples openenergymonitor.org, Licence GNU GPL V3
#include "EmonLib.h" // Include Emon Library
EnergyMonitor emon1; // Create an instance
void setup()
{
Serial.begin(9600);
emon1.voltage(2, 234.26, 1.7); // Voltage: input pin, calibration, phase_shift
emon1.current(1, 111.1); // Current: input pin, calibration.
}
void loop()
{
emon1.calcVI(20,2000); // Calculate all. No.of half wavelengths (crossings), time-out
emon1.serialprint(); // Print out all variables (realpower, apparent power, Vrms, Irms, power factor)
float realPower = emon1.realPower; //extract Real Power into variable
float apparentPower = emon1.apparentPower; //extract Apparent Power into variable
float powerFActor = emon1.powerFactor; //extract Power Factor into Variable
float supplyVoltage = emon1.Vrms; //extract Vrms into Variable
float Irms = emon1.Irms; //extract Irms into Variable
}
i try using thease code, but its add 2 serial print datasonly.
increment example,
int i = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
i = i + 1;
Serial.println(i);
delay(1000);
}
Above library print contieosly ,active , apparent power and RMS voltage, RMS current and power factor.
So i need to get the addition of the all printed active power values.
i kindly request please help me to find this.
thanks