34 lines
1.1 KiB
C++
34 lines
1.1 KiB
C++
// EmonLibrary examples openenergymonitor.org, Licence GNU GPL V3
|
|
|
|
#include "EmonLib.h" // Include Emon Library
|
|
EnergyMonitor emon1; // Create an instance
|
|
EnergyMonitor emon2; // Create an instance
|
|
|
|
void setup()
|
|
{
|
|
Serial.begin(9600);
|
|
|
|
emon1.current(A0, 66); // Current: input pin, calibration.
|
|
emon2.current(A1, 66); // Current: input pin, calibration.
|
|
|
|
}
|
|
|
|
void loop()
|
|
{
|
|
double Irms = emon1.calcIrms(1440); // Calculate Irms only
|
|
Serial.print("General = ");
|
|
|
|
// emon1.serialprint(); // Print out all variables (realpower, apparent power, Vrms, Irms, power factor)
|
|
Serial.println(Irms*230.0 -7); // Apparent power
|
|
// Serial.print(" ");
|
|
// Serial.println(Irms); // Irms
|
|
delay(2000);
|
|
Serial.print("Solaire = ");
|
|
Irms = emon2.calcIrms(5000); // Calculate Irms only
|
|
// emon1.serialprint(); // Print out all variables (realpower, apparent power, Vrms, Irms, power factor)
|
|
Serial.println(Irms*230.0 -7); // Apparent power
|
|
// Serial.print(" ");
|
|
// Serial.println(Irms); // Irms
|
|
delay(2000);
|
|
}
|