crisap94 / MHZ19

MH-Z19 CO2 sensor library for ESP8266 or Arduino
Other
68 stars 24 forks source link

ESP8266 hardware UART #10

Closed enjoyneering closed 4 years ago

enjoyneering commented 4 years ago

ESP8266 has two hardware UART. Why use a SoftSerial?

Serial.begin(9600, SERIAL_8N1); //GPIO1 (TX) and GPIO3 (RX), 9600kbps, 8-bit data, no parity, 1-bit stop

//your brilliant ESP8266 code here

Serial.swap(); //GPIO15 (TX) and GPIO13 (RX) Serial.flush(); //clear serial buffer

//your brilliant MHZ19 code here

Serial.swap(); //swap back to GPIO1 (TX) and GPIO3 (RX) Serial.flush(); //clear serial buffer

//your brilliant ESP8266 code here