PaulStoffregen / AltSoftSerial

Software emulated serial using hardware timers for improved compatibility
http://www.pjrc.com/teensy/td_libs_AltSoftSerial.html
328 stars 131 forks source link

Replacing Softwareserial by Altsoftserial #44

Open geologic opened 6 years ago

geologic commented 6 years ago

Hi all

I have a Uno connected to a ESP8266 to send a GET request to a webserver. I use softwareserial and wifiesp library like this:

WiFiEspClient client;
#include <SoftwareSerial.h>
SoftwareSerial Serial1(8,9);

  // initialize serial for ESP module
  Serial1.begin(9600);
  // initialize ESP module
  WiFi.init(&Serial1);

...

    // Make a HTTP request
    client.println(F("GET /sensor.php?id=1 HTTP/1.1"));
    client.println(F("Host: www.domain.com"));
    client.println(F("Connection: close"));
    client.println();

    //read HTTP response
    while (client.connected()) {
      while (client.available()) { 
        char ch=client.read();
        Serial.print(ch);
      }
    }

The request is done and I can see the HTTP response on the serial monitor. Now i want to replace softwareserial for Altsoftserial so i made this changes:

//#include //SoftwareSerial Serial1(8,9);

include

AltSoftSerial Serial1;

I double check my wires, ESP8266 module is working, request is sent to PHP page but i cannot see HTTP response on the serial monitor.

If i put back softwareserial on code, it works ok.

Any ideas?

PaulStoffregen commented 6 years ago

AltSoftSerial does not support ESP.