I have an Arduino Uno and an ESP8266 connected to it. I want the ESP8266 to function both as server and client. I know it should be possible, because I have it running on the esp8266 based Wemos board.
However, the libraries for the Wemos board allow me to start a client and a server object, and the SoftwareSerial library for the UNO does not have that option. Essentially all it offers is the AT-commands.
I can do the AT commands to attach to the access point, give the ESP8266 its private IP number etc, no problem. Then I can either read a webpage on a server somewhere or I can access the ESP8266 as a server and read a webpage stored there.
But in one single sketch I can do one or the other and then the other option does not work any more.
These are the AT command I use:
esp8266.begin(9600); // your esp's baud rate might be different
sendData("AT+RST\r\n",2000,DEBUG); // reset module
sendData("AT+CWMODE=3\r\n",1000,DEBUG); // configure both as access point and as station
sendData("AT+CIFSR\r\n",1000,DEBUG); // get ip address
sendData("AT+CIPMUX=1\r\n",1000,DEBUG); // configure for multiple connections
sendData("AT+CIPSERVER=1,80\r\n",1000,DEBUG); // turn on server on port 80
Then, either the remote server and the server on the esp8266 can be accessed, but not both
I start the reading of the remote with
and end the routine with
Similarly I start the server with
and finish with
What did I get wrong?