CamWebServer with WiFi in AP
Posted: Sun Oct 13, 2019 9:10 pm
Hi there,
I'm porting the CAmWebServer Demo to be used in WiFi AP.
The code almost works, but it crashes after a while.
I can connect to the camera (in AP WiFi mode) with my phone.
Then I have the the following issue: after 10 seconds (approx.) I start to stream the Webserver it crashes...
The message error I've got is the following
E (232004) httpd: httpd_server_init: error in bind (112)
Starting stream server on port: '81'
Camera Ready! Use 'http://0.0.0.0' to connect
Despite the above error the camera stream data for a while... but after a while it won't recover.
when the program crash I've got the following messages:
E (418709) httpd: mem alloc failed
Starting stream server on port: '81'
E (418716) httpd: mem alloc failed
Camera Ready! Use 'http://0.0.0.0' to connect
Starting web server on port: '80'
Maybe I'm using the wrong memory model ? (I'm using Huge Model ).
I would appreciate any help or suggestions... we are trying to put a new product in the market by December and we would love to use the Arduino IDE to speed up the process.
This is the part of the code that I have altered from the original sketch:
WiFi.softAP(ssid, password);
IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
server.begin();
Serial.println("Server started");
}
void loop() {
WiFiClient client = server.available(); // listen for incoming clients
if (client) { // if you get a client,
Serial.println("New Client."); // print a message out the serial port
String currentLine = ""; // make a String to hold incoming data from the client
while (client.connected()) { // loop while the client's connected
if (client.available())
{ // if there's bytes to read from the client,
startCameraServer();
Serial.print("Camera Ready! Use 'http://");
Serial.print(WiFi.localIP());
Serial.println("' to connect");
}
}
// close the connection:
client.stop();
Serial.println("Client Disconnected.");
}
}
Thank you in Advance for your help.
I'm porting the CAmWebServer Demo to be used in WiFi AP.
The code almost works, but it crashes after a while.
I can connect to the camera (in AP WiFi mode) with my phone.
Then I have the the following issue: after 10 seconds (approx.) I start to stream the Webserver it crashes...
The message error I've got is the following
E (232004) httpd: httpd_server_init: error in bind (112)
Starting stream server on port: '81'
Camera Ready! Use 'http://0.0.0.0' to connect
Despite the above error the camera stream data for a while... but after a while it won't recover.
when the program crash I've got the following messages:
E (418709) httpd: mem alloc failed
Starting stream server on port: '81'
E (418716) httpd: mem alloc failed
Camera Ready! Use 'http://0.0.0.0' to connect
Starting web server on port: '80'
Maybe I'm using the wrong memory model ? (I'm using Huge Model ).
I would appreciate any help or suggestions... we are trying to put a new product in the market by December and we would love to use the Arduino IDE to speed up the process.
This is the part of the code that I have altered from the original sketch:
WiFi.softAP(ssid, password);
IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
server.begin();
Serial.println("Server started");
}
void loop() {
WiFiClient client = server.available(); // listen for incoming clients
if (client) { // if you get a client,
Serial.println("New Client."); // print a message out the serial port
String currentLine = ""; // make a String to hold incoming data from the client
while (client.connected()) { // loop while the client's connected
if (client.available())
{ // if there's bytes to read from the client,
startCameraServer();
Serial.print("Camera Ready! Use 'http://");
Serial.print(WiFi.localIP());
Serial.println("' to connect");
}
}
// close the connection:
client.stop();
Serial.println("Client Disconnected.");
}
}
Thank you in Advance for your help.