HTTP REQUEST

hello my name is Marco I'm using an esp866 in which I use an http request but I have a problem
'class SoftwareSerial' has no member named 'connect'
I send the code below

printWifiStatus();

Serial.println();
Serial.println("Starting connection to server...");
// if you get a connection, report back via serial
if (client.connect(server, 8080)) {
Serial.println("Connected to server");
// Make a HTTP request
String content = "un mensaje de post";
client.println("POST /testPost HTTP/1.1");
client.println("Host: 192.168.100.50:8080");
client.println("Accept: */*");
client.println("Content-Length: " + content.length());
client.println("Content-Type: application/json");
client.println("Cache-Control: no-cache");
client.println(content);
}
#include <WiFiEspClient.h>
#include <WiFiEspServer.h>
#include <WiFiEspUdp.h>




#include "WiFiEsp.h"

// Emulate Serial1 on pins 6/7 if not present
#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
SoftwareSerial Serial1(10,11); // RX, TX
#endif

char ssid[] = "Kioru 2.4";            // your network SSID (name)
char pass[] = "K10RU!!!";        // your network password
int status = WL_IDLE_STATUS;     // the Wifi radio's status

char server[] = "192.168.100.50";

// Initialize the Ethernet client object
WiFiEspClient client;

void setup()
{
// initialize serial for debugging
Serial.begin(115200);
// initialize serial for ESP module
Serial1.begin(115200);
// initialize ESP module
WiFi.init(&Serial1);

// check for the presence of the shield
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue
while (true);
}

// attempt to connect to WiFi network
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to WPA SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network
status = WiFi.begin(ssid, pass);
}

// you're connected now, so print out the data
Serial.println("You're connected to the network");

printWifiStatus();

Serial.println();
Serial.println("Starting connection to server...");
// if you get a connection, report back via serial
if (client.connect(server, 8080)) {
Serial.println("Connected to server");
// Make a HTTP request
String content = "un mensaje de post";
client.println("POST /testPost HTTP/1.1");
client.println("Host: 192.168.100.50:8080");
client.println("Accept: */*");
client.println("Content-Length: " + content.length());
client.println("Content-Type: application/json");
client.println("Cache-Control: no-cache");
client.println(content);
}
}

void loop()
{
// if there are incoming bytes available
// from the server, read them and print them
while (client.available()) {
char c = client.read();
Serial.write(c);
}

// if the server's disconnected, stop the client
if (!client.connected()) {
Serial.println();
Serial.println("Disconnecting from server...");
client.stop();

// do nothing forevermore
while (true);
}
}


void printWifiStatus()
{
// print the SSID of the network you're attached to
Serial.print("SSID: ");
Serial.println(WiFi.SSID());

// print your WiFi shield's IP address
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);

// print the received signal strength
long rssi = WiFi.RSSI();
Serial.print("Signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
}

I look forward to your reply as soon as possible

To make it easy for people to help you please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum

Your code is too long for me to study quickly without copying to a text editor.

I have not studied your code but why would you be trying to use "connect" with an instance of SoftwareSerial?

...R

READY,
I CAN ALWAYS CHANGE IT

chavoo:
I CAN ALWAYS CHANGE IT

I don't understand ?

And please don't SHOUT.

...R

Please post the actual error message. It will include the line on which the compiler found the error.

...R

sorry, the problem it's in the class SoftwareSerial to have don't member named 'client'

chavoo:
sorry, the problem it's in the class SoftwareSerial to have don't member named 'client'

No, that is NOT the problem. The problem is that you have not posted the COMPLETE error message, so that we can see which line of code is causing the problem.

You should NOT be expecting your SoftwareSerial instance, Serial1, to have a client member, and it does not appear that your code does, unless the code you posted isn't the code you are trying to compile.

In function 'void setup()':

03_07_2018:39: error: 'class SoftwareSerial' has no member named 'connect'

if ((esp8266.connect(server, PORT))) {

^

exit status 1
'class SoftwareSerial' has no member named 'connect'

chavoo:
In function 'void setup()':

03_07_2018:39: error: 'class SoftwareSerial' has no member named 'connect'

if ((esp8266.connect(server, PORT))) {

^

exit status 1
'class SoftwareSerial' has no member named 'connect'

true, but in your sketch published in original post you have no such line.

what Arduino board you have?

SoftwareSerial isn't working at 115200 baud. use 9600 baud. but set it ti AT firmware too

i'm using arduino leonarlo, for to connect a the network , i use 115200 baud, are you understand?, i might talk in the spanish

chavoo:
i'm using arduino leonarlo, for to connect a the network , i use 115200 baud, are you understand?, i might talk in the spanish

If you are using Serial1 on the Leonardo then you can use 115200 baud. But not if you are using SoftwareSerial.

If Spanish is your language why not ask in the Spanish section of the Forum?

...R

my problem is already more complicated, change the library to WifiEspClient and this appears

chavoo:
my problem is already more complicated, change the library to WifiEspClient and this appears

the library is only one - WiFiEsp. it doesn't help you to include partial includes of the library

chavoo:
my problem is already more complicated, change the library to WifiEspClient and this appears

You are making it almost impossible to help because you provide such tiny amounts of information which seem to hang in the air without any background context.

We won't charge you extra if you write 10 lines of explanation :slight_smile:

...R