#include "EmonLib.h" // Include Emon Library
EnergyMonitor emon1; // Create an instance
void setup()
{
Serial.begin(115200);
delay(1000);
emon1.current(A0, 111.1);// Current: input pin, cal
}
double Irms = emon1.calcIrms(1480); // Calculate Irms only
void loop()
{
delay(1000);
Irms = emon1.calcIrms(1480); // Calculate Irms only
if (Irms < .2)
{
Serial.println("No Current");
Serial.println(Irms);
}
else if (Irms >= 1.2)
{
Serial.println("Current ON");
Serial.println(Irms);
}
else
{
Serial.println("Transtion between on and off or visa versa");
}
}
Comments