olehs / PZEM004T

Arduino communication library for Peacefair PZEM-004T Energy monitor
MIT License
229 stars 114 forks source link

Hardware serial (ESP8266) Example #26

Closed DimChik2903 closed 6 years ago

DimChik2903 commented 7 years ago

I can not figure out how to write a sketch to work with the hardware serial (RX/TX pin) on ESP8266. Could you add an example? Thank you in advance!

vortigont commented 7 years ago

@DimChik2903 Something like this would do

HardwareSerial hwser(UART0);
PZEM004T pzem(&hwser); // Connect to PZEM via HW_serial
hwser.swap();                      // (optional) swap hw_serial pins to gpio13(rx),15(tx)
hnaeem07 commented 6 years ago

Thanks a lot, it works.