1

I have the code below and it doesn't work with my URL. I receive a

715(Handshake Failed)

This code below works normally, but with my API it doesn't work.

I'm using a A7670SA with Arduino Mega 2560.

My API is on Heroku and uses an Automated Certificate Management by Heroku, that uses the Let's Encrypt.

String sendATCommand(String command, String expectedResponse = "", unsigned long timeout = 5000) {
  Serial1.println(command);
  Serial.println("Command send: " + command);

  unsigned long startTime = millis();

  String response = "";

  while (millis() - startTime < timeout) {
    if (Serial1.available() > 0) {
      char c = Serial1.read();
      response += c;
    }
  }

  response.replace(command, "");

  Serial.println(response);

  delay(500);
  return response;
}

void setup() {
  Serial.begin(115200);
  while (!Serial)
    ;

  delay(1000);

  Serial1.begin(115200);

  sendATCommand("AT", "OK");  

  sendATCommand("AT+CGREG?");
  sendATCommand("AT+CGDCONT=1,\"IP\",\"claro.com.br\"", "OK");

  sendATCommand("AT+HTTPINIT");  // Iniciar ambiente HTTP

  sendATCommand("AT+HTTPPARA=\"URL\",\"https://httpbin.org/\"");

  sendATCommand("AT+HTTPACTION=0", "OK", 1000);

  sendATCommand("AT+HTTPREAD?");

  sendATCommand("AT+HTTPTERM", "OK");
}

void loop() {}
1
  • what is your specific question?
    – jsotola
    Commented Mar 31 at 17:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.