Open margohaux opened 1 year ago
HI! I wanted to reset the energy but it does not work :( ...
if(thingspeak.readfloatfield(channel, apikey)==1){ uint16_t u16CRC = 0xFFFF; /* declare CRC check 16 bits*/ static uint8_t resetCommand = 0x42; /* reset command code*/ uint8_t slaveAddr =0X01; u16CRC = crc16_update(u16CRC, slaveAddr); u16CRC = crc16_update(u16CRC, resetCommand); preTransmission(); Serial.write(slaveAddr); Serial.write(resetCommand); Serial.write(lowByte(u16CRC)); Serial.write(highByte(u16CRC)); delay(10); postTransmission(); delay(100); } }
Hey, have you tried using the resetEnergy function in the library?
resetEnergy
Something along the lines of:
PZEM004Tv30 pzem(Serial); psem.resetEnergy(); float energy = pzem.energy(); // -> 0
HI! I wanted to reset the energy but it does not work :( ...