olehs / PZEM004T

Arduino communication library for Peacefair PZEM-004T Energy monitor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hardware serial (ESP8266) Example

DimChik2903 opened this issue · comments

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!

@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)

Thanks a lot, it works.