S8_UART icon indicating copy to clipboard operation
S8_UART copied to clipboard

Suggestion to Enable Universal Serial Compatibility

Open NatanaelJose opened this issue 1 year ago • 1 comments

Hello,

I hope everything is going well. I'm a user of Sense air S8 sensor, and I have a suggestion that could benefit many users facing challenges with serial communication on boards that don't have direct support for Softwareserial or HardwareSerial.

Suggestion: Implementation of EspSoftwareSerial for Boards Without Support

Currently, some users of boards, such as ESP32 LILYGO®LoRa32 V2.1_1.6, may encounter limitations with Softwareserial or HardwareSerial libraries. A valuable alternative would be the implementation of the EspSoftwareSerial library to provide a more flexible and comprehensive solution.

Implementation Suggestion:

  1. Add support for the EspSoftwareSerial library in the installation instructions or in the project's README. Additionally, provide a usage example to guide users in implementing EspSoftwareSerial in their projects.

  2. Usage Example:

    #include "s8_uart.h"
    #include <SoftwareSerial.h> //EspSoftwareSerial include
    
    EspSoftwareSerial::UART S8_serial;
    S8_UART *sensor_S8;
    S8_sensor sensor;
    
    void setup() {
      Serial.begin(9600);
      while (!Serial) {
      }
      // Initialize S8 sensor
      S8_serial.begin(S8_BAUDRATE, EspSoftwareSerial::SWSERIAL_8N1, 21, 22);
      sensor_S8 = new S8_UART(S8_serial);
    }
    
    void loop() {
      sensor.co2 = sensor_S8->get_co2();
      Serial.print("CO2 value = ");
      Serial.print(sensor.co2);
      Serial.println(" ppm");
      delay(1000);
    }
    
    

Contribution to the Community: The inclusion of EspSoftwareSerial can provide a broader solution for users of various boards, improving usability and accessibility in projects that require serial communication.

Thank you for your attention and consideration. I am available to provide more information or clarify any doubts.

Best regards, Natanael José

NatanaelJose avatar Jan 17 '24 19:01 NatanaelJose