So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By cjohnweb
#81402
QuickFix wrote:Insert a yield() or delay(0) inside the while (client.connected() || client.available())-loop: you're choking the WiFi-stack now. :idea:

Although adequate for testing purposes, you should consider a state machine for real applications.


Hi there, thanks for the reply.

I tried adding delay() in a few places with 0-10 ms but still same issue. Same result using yield().

State machine generally sounds like a good idea, just read about it a couple days ago (https://www.espruino.com/StateMachine) and in all honesty I'll probably start using this or another in the near future. I am a React and React Native developer, state is something I am familiar with and comfortable with. But at the moment the application is basically done minus a few bugs and I'm eager to just get this done. I have a few variables tracking milliseconds and firing things off when the appropriate amount of time has passed. It's not a very complicated sketch and it seems to solve the basic issues I was having before. On the other hand, if you think it will solve this problem of mine that's a different story.

What do you think the chances are of my ESP perhaps being broken? Like, say when I was fiddling with the DHT11 temp sensor one of the wires may have shorted the 5v to one of the other pins. Do ESP's ever like "half break" where it seems like it's working but it crashes like this all the time? I've now tried 5 different example http scripts, pointed to different servers, tested with different access points...this is really thrown me for a loop.