Description
Basic Infos
Hardware
Hardware: ESP-12
Core Version: Latest NodeMCU
Description
Problem description
Hey guys. I've been working on a new project with my generic ESP-12, posting to dweet.io. The method I use to post to dweet is below. I constantly loop it, sending it once every 1 second. I'm just sending dummy data currently.
It works well for maybe 12 hours or so, and then it just sends them very intermittently, and then it will completely stop.. I use a LED to notify me of the status of wifi connection, and it stays connected. It also flashes each time a successful request is sent. When it stops working, the LED just stays constantly on. I have a solid 2 amp power supply with a 100uF cap, and a 0.1uF.
Is there anything in my code that seems like it could cause an issue? If not, maybe I should check the rest of my code if there is a leak or anything sketchy. Thank you very much.
Sketch
void send_to_server(float acceleration)
{
const char* host = "dweet.io";
WiFiClient client;
const int httpPort = 80;
if (!client.connect(host, httpPort)) {
client.stop();
return;
}
client.print(String("GET /dweet/for/test?acc=") + String(acceleration) + " HTTP/1.1\r\n" +
"Host: " + host + "\r\n" +
"Connection: close\r\n\r\n");
delay(10);
int timer = millis();
while (client.available() == 0) {
delay(10);
if (millis() - timer > 5000) {
Serial.println("Timeout");
client.stop();//Tried with and without
return;
}
}
digitalWrite(16, LOW);
while(client.available())
String line = client.readStringUntil('\r');
digitalWrite(16, HIGH);
client.stop();//Tried with and without
}