2

I am using a NodeMCU, so ESP8266. I installed the core via the Boards Manager at the last version.

My goal is to control a GoPro camera through WiFi.

I am getting mad with these few lines of code:

uint8_t GoProControl::sendRequest(String request) {
    client.stop();
    if (!client.connect(_host.c_str(), _port)) {
        if (debugStatus){
            Serial.println("Connection lost");
            GoProConnected = false;
        }
    return false;
    }

    client.print(request);
    client.print("Connection: close\r\n\r\n");

    if (debugStatus){
        Serial.println("my request is:");
        Serial.println("-------------");
        Serial.print(request);
        Serial.print("Connection: close\r\n\r\n");
        Serial.println("-------------\n");
    }
    if (listen() == "HTTP/1.1 200 OK\r") {
        return true;
    }
    else {
        return false;
    }

}

the client is connected without problem (it never gives me error) and so i send the request:

GET http://10.5.5.9/camera/SH?t=password&p=%00 HTTP/1.1
Connection: close

the listen function mainly does:

char c = client.read();
response += c;

and then print the response, this is what i get from it:

HTTP/1.1 404 Not Found
Connection: close
Date: Sat, 13 Jan 2018 16:26:27 GMT
Server: Cherokee/1.2.101b150604_3b16072 (UNIX)
Content-Length: 355
Content-Type: text/html
Cache-Control: no-cache
Pragma: no-cache

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head><title>404 Not Found</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<h1>404 Not Found</h1>
The requested URL /camera/SH was not found on this server.
<p><hr>
Cherokee web server 1.2.101b150604_3b16072 (UNIX), Port 80
</body>
</html>

It looks like I am connected to the wrong host. Since I am sure that this is the correct request, where is possible that I am doing any error?

  • 1
    can you connect to it with your computer? – jsotola Jan 17 '18 at 3:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.