Open almln opened 5 years ago
Hi, i Had same problem, use AlsoftSerial and solved. Only have a look to TX & RX pins... for NANO are 8 & 9.
MHZ19 myMHZ19; // Constructor for MH-Z19 class SoftwareSerial mySerial(RX_PIN, TX_PIN); AltSoftSerial BT1(8,9);
void setup() { // Configuro puertos mySerial.begin(BAUDRATE); BT1.begin(9600); delay(1000);
myMHZ19.begin(mySerial);
And continue with rest of code............
Regards
If i want to use several software serial ports (i.e. BT module), then your implementation blocks software serial, because more than one opened ports can't work together at the same time on the chip (i.e. see https://forum.arduino.cc/index.php?topic=442387.0). Solution may be in the way of create-open-close procedure inside each method of the class SensorMH_Z19B, if needed. This may result in performance issues, but can solve the problem.