olehs / PZEM004T

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

Software Serial Instantiation #62

Closed AntaresAdroit closed 4 years ago

AntaresAdroit commented 4 years ago

Hey, I couldn't make the existing software serial implementation work with an ESP8266 (which might have been something I was doing incorrectly). I noticed there is an ESP specific software serial library here: https://github.com/plerup/espsoftwareserial. I added instantiation methods for passing in a software serial object and an example. In general, I tried to get the hardware serial examples to work, but I had troubles (the RX pin pulling GPIO15 high is kind of a bummer). This seemed to me like the most straight forward way to talk to the PZEM004T and to be able to debug through the terminal. I think it might be useful for others as well. The example code works well; hopefully I haven't overlooked any other key functionality in the class.

olehs commented 4 years ago

Hi. The library you mention is actualy the one included in Arduino SDK (link) and is used internally by PZEM004T(uint8_t receivePin, uint8_t transmitPin) constructor.

AntaresAdroit commented 4 years ago

I must have been doing something else wrong. I tried the pin number constructor again and it is working. Thanks for you response.