Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Shdwdrgn
#37329 I'm trying to set up a project where an arduino controls a motor speed (among other things). Commands are sent from a php script using a non-standard port, but I also need to send info from the arduino back to the php script.

I'm using an ESP8266-01 with AT_V00180902_02 loaded for the AT command set. I've worked my way through the commands to where the arduino can receive info from the php script. I can also code it to where I can send info to the php script. The problem occurs with two-way traffic, trying to do both functions which can sometimes happen simultaneously. For example I set up a simple ping so that every 5 seconds the php script sends a literal "PING" text to the arduino, and the arduino responds back with a "PONG" to show it is still alive. However if another command comes in from the php script while the arduino is trying to send out the pong, the esp seems to get completely confused by the multiple traffic and I wind up with a number of "busy s..." errors and a complete shutdown of traffic going in either direction.

That's where I've been all weekend, and I'm completely fed up. There has got to be a better solution, something not involving the AT command set. I find references to using the esp8266 library from github, which I successfully installed in the arduino IDE, but then I hit a blank wall trying to find documentation on how to use this library and a lack of any examples for doing what I'm trying to do. Most frustrating is that none of the examples I did find seemed to bother explaining what code should be installed on the arduino and what code should be installed on the 8266.

Can somebody please help me figure out how to get this going, maybe point me to some guides that actually explain where to start? My current attempts have been using TCP and just opening a new connection each time I want to send info in either direction, but maybe there's a better solution that will allow opening a single connection and talking both ways through that port? The goal is to have several of these arduino setups talking to the php script, so I have treated it as if the php-side is the server and the arduinos are clients. I've done similar projects with internet-based PC connections and never had any trouble, so this is really frustrating me...
User avatar
By Shdwdrgn
#37348 By the way, just to clarify -- I'm not trying to use a webserver between all of this. Rather the php code itself is the server just listening for strings on the set port and interpreting the information sent. That's really all I need to be able to do is just send and receive strings reliably from the 8266, with the expectation that both sides might be trying to send data at the same time.