Good day, I'm having a project to measure the time usage of a device. I use the current sensor SCT 013 030 and node MCU to detect when the device is working. The reading from the sensor is sent to Thingspeak and more importance is I want to build the timer to measure how long the device has been working.
At first, I use the millis () to get the time difference when the device is switched on and off. I also used interrupt, because my idea was that when the device started working, the interrupt would be executed and the millis () would start.
However I find my mistake here, because the millis () begins when the the Arduino board began running the current program.
Could anyone please help or give me idea how to measure the time usage of a device. If any part of this coding can be improved, please guide me. And please excuse my bad English. Thanks a lot for your time.