2
  void toSerial(int delay_ms)
  {
    delay(delay_ms);

    while(mySerial.available()) 
    {
       Serial.write(mySerial.read());
    }
  }

  Serial.begin(9600);
  mySerial.begin(9600);

  mySerial.println("AT+HTTPINIT"); 
  toSerial(500);

  mySerial.println("AT+HTTPPARA=\"CID\", 1"); 
  toSerial(500);

  mySerial.println("AT+HTTPPARA=\"URL\", \"www.example.test\"");
  toSerial(500);

  mySerial.println("AT+HTTPPARA=\"CONTENT\", \"application/json\"");
  toSerial(500);

  mySerial.println("AT+HTTPACTION=0"); 
  toSerial(4000);

  mySerial.println("AT+HTTPREAD");
  delay(3000);

  while(mySerial.available()) 
  {
    Serial.write(mySerial.read());
  }

  Serial.println("");
  mySerial.println("AT+HTTPTERM"); 
  toSerial(500);

Result:

AT+HTTPREAD

+HTTPREAD:39
{"pinRed":0,"pinGreen":1,"pinYello

I expect messages:

{"pinRed":0,"pinGreen":1,"pinYellow":0}
wgerro
  • 51
  • 3

1 Answers1

1

Okay, I've found a solution. To start with, you need to download the server response length and loop according to the response length.

wgerro
  • 51
  • 3