Post topics, source code that relate to the Arduino Platform

User avatar
By rafik73_nodemcu
#51087 Hello.
ESP8266 plugged into the Arduino Mega 2560. I want to download the contents of the page. Listing:

Code: Select all#define ESP8266 Serial3
#define SERVER "192.168.1.8"

void setup()
{
    Serial.begin(9600);
    ESP8266.begin(115200);

   String cmd = "AT+CIPSTART=\"TCP\",\"";
  cmd += SERVER;
  cmd += "\",8095";
  ESP8266.println(cmd);
  Serial.println(cmd);
  if(ESP8266.find("Error")) return;
  cmd = "GET /api HTTP/1.1\r\nHost:192.168.1.8:8095\r\nApiCode:8273\r\nContent-Type: application/json\r\nConnection: keep-alive\r\n\r\n";
  ESP8266.print("AT+CIPSEND=");
  ESP8266.println(cmd.length());

  if (ESP8266.find(">"))
  {
    Serial.print(">");
  }
    else
    {
      ESP8266.println("AT+CIPCLOSE");
      Serial.println("connected timeout");
      delay (1000);
      return;
  }
ESP8266.print(cmd);
delay(350);

while(ESP8266.available())
{
  char c = ESP8266.read();
   Serial.print(c);
 }
}
void loop()
{

}


result in the serial monitor:

Code: Select allAT+CIPSTART="TCP","192.168.1.8",8095
>
Recv 114 bytes

SEND OK

+IPD,203:HTTP/1.1 200 OK
Conte


In fact, only reads the word "Conte", cut the headline does not mention the content.
How to read the entire contents?
User avatar
By alberthandsome
#51093 Hi, I made a combination as below:

pc
via pl2303hx LLC 5/3.3v ESP8226 power source 3.3v
VCC --- VCCH
GND --- GNDH
RXT --- RXTH RXTL --- TXT
TXT --- TXTH TXTL --- RXT
VCCL --- VCC,CH_PD --- VCC
GNDL --- GND --- GND

Terminal set 9600bps, 8n1:

[00][00][00]AT
PUHř[00]AT+RST
ő’MQ5
[00]AT+GMR
5I5
[00]

When I set esp8266.RESET to high nothing happens. R Programming Training | DataStage Training | SQL Training | SAS Training |Android Training | SharePoint Training