WifWaf / MH-Z19

For Arduino Boards (&ESP32). Additional Examples/Commands., Hardware/Software Serial
GNU Lesser General Public License v3.0
195 stars 39 forks source link

SoftwareSerial not working #8

Closed haldi4803 closed 4 years ago

haldi4803 commented 4 years ago

`error: no matching function for call to 'SoftwareSerial::SoftwareSerial(int, int)'

SoftwareSerial mySerial(RX_PIN, TX_PIN); // Uno example`

With ESPSoftwareSerial 5.3.4 from: https://github.com/plerup/espsoftwareserial/ Which version do you recommend?

WifWaf commented 4 years ago

Hi,

Yes, this line only demonstrates the SoftwareSerial functionality for an UNO. The library behind it will be different.

I haven't used the ESP8266 before (looking at the library you've provided), however, you should be able to create an instance of the library and pass it to my library. I'm not sure about versions/library choice.

Have a look at the example provided

So.. something like (I can't test this, unfortunately).

MHZ19 myMHZ19; SoftwareSerial swSer

void setup() { delay(2000);

Serial.begin(115200); Serial.println("\nOne Wire Half Duplex Serial Tester");

swSer.begin(115200, 14, 14, SWSERIAL_8N1, false, 256); swSer.enableIntTx(true);

myMHZ19.begin(swSer). }

Have a look at the header file they are using for the software serial .begin() arguments. Line 53.

positron96 commented 4 years ago

By the way, the built-in SoftwareSerial library in ESP8266 core works fine with MH-Z19 and this library. It has same interface as AVR library (accepts 2 pins in constructor).

WifWaf commented 4 years ago

Closing due to inactivity, feel to open a new issue.