mandulaj / PZEM-004T-v30

Arduino library for the Updated PZEM-004T v3.0 Power and Energy meter
MIT License
256 stars 108 forks source link

Can't call reset energy from arduino uno, how to reset pzem energy from arduino uno? #52

Closed rizkiaditya060 closed 3 years ago

mandulaj commented 3 years ago

Have you tried calling the pzem.resetEnergy() function? I need more information in order to help you. Could you show me some code which illustrates your issue?

Try something like this:

float energy_before = pzem.energy();
pzem.resetEnergy();
delay(200); // Note this delay, the library only updates values once every couple of milliseconds. So wait a bit to get fresh values

float energy_after = pzem.energy();

Serial.print("Energy before: ");
Serial.println(energy_before);

Serial.print("Energy after: ");
Serial.println(energy_after);
rizkiaditya060 commented 3 years ago

Doing what you suggest and it work, thanks

Pada tanggal Jum, 5 Feb 2021 02.15, Jakub Mandula notifications@github.com menulis:

Have you tried calling the pzem.resetEnergy() function? I need more information in order to help you. Could you show me some code which illustrates your issue?

Try something like this:

float energy_before = pzem.energy(); pzem.resetEnergy();delay(200); // Note this delay, the library only updates values once every couple of milliseconds. So wait a bit to get fresh values float energy_after = pzem.energy();

Serial.print("Energy before: "); Serial.println(energy_before);

Serial.print("Energy after: "); Serial.println(energy_after);

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mandulaj/PZEM-004T-v30/issues/52#issuecomment-773542666, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASWLRO4DXIXKX37KA6U26WLS5LW3JANCNFSM4W6XO7RA .