AltSoftSerial icon indicating copy to clipboard operation
AltSoftSerial copied to clipboard

Replacing Softwareserial by Altsoftserial

Open geologic opened this issue 7 years ago • 1 comments

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.h> //SoftwareSerial Serial1(8,9);

#include <AltSoftSerial.h> 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?

geologic avatar Feb 01 '18 15:02 geologic

AltSoftSerial does not support ESP.

PaulStoffregen avatar Feb 01 '18 22:02 PaulStoffregen