Hello, am planning to stops the incoming data, say for example at 23:55:00 pm. And then, resumes again at 00:00:00 am. i do that because i want to use the data for something else. By the way, i am using PLX-DAQ ver2 to send the data to Excel and it's real time logging at a minute interval.
Here's what i've got so far
#include "EmonLib.h"
// Include Emon Library
EnergyMonitor emon1;
// Create an instance
unsigned long previousMillis = 0;
const unsigned long interval = 5000;
void setup()
{
Serial.begin(9600);
Serial.println("CLEARDATA");
Serial.println("LABEL,Date,Time,Current,Power, millis()");
emon1.current(1, 85.1); // Current: input pin, calibration.
}
void loop()
{
double Irms = emon1.calcIrms(2580); // Calculate Irms only
double Prms = Irms*230.0;
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
Serial.print(Prms); // Apparent power
Serial.print(" ");
Serial.println(Irms); // Irms
Serial.println(" ");
Serial.println( (String) "DATA,DATE,TIME," + Irms + "," + Prms + "," + millis() + ",AUTOSCROLL_30");
previousMillis = currentMillis;
}
}