I have an Arduino Uno and a server written in C++. I connected the ESP8266 to my router successfully using the following code:
#include <SoftwareSerial.h>
SoftwareSerial esp8266(3, 2);
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Started");
// set the data rate for the SoftwareSerial port
esp8266.begin(115200);
esp8266.write("AT\r\n");
}
void loop() {
if (esp8266.available()) {
Serial.write(esp8266.read());
}
if (Serial.available()) {
esp8266.write(Serial.read());
}
}
Now, I want the ESP8266 to connect to my server as a client in the same LAN (I have the server IP). How can I do it with SoftwareSerial? Is there another way to do it?