Communication with esp8266 server

Hi all,
I am trying to create a two-way communication between app inventor and ESP 8266. I want to send / receive text messages through one established connection without closing connection. Directly to the problems I face:

  1. Through app inventory I successfully build a connection to the ESP server on the specified IP and port, but when sending a message to the client from the ESP, the connection must be disconnected so that I can see the sent text.
  2. When I try to send text to the ESP from an already established connection from app inventor, nothing is sent or a new connection is opened.

I tried a few extensions, but the problems were not solved. If anyone has a solution please share a project or give an example.
Thanks in advance.

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

So ... The timer is so that I don't send commands too often so that there is time to react on the other side. When the On and Off buttons are clicked, data is sent and the connection is closed almost immediately after sending, as shown by "SocketTimeout = 1". If I send data and leave the connection open "SocketTimeout = 0" as seen by clicking the "SandAndStay" button, data is sent and the connection remains open.
On the other side I receive the data with the connection number. When I send data to this client knowing the connection number, the data is not displayed in the app inventory until the connection is closed by one of the sides. The extension says that the messages are displayed when a new text line persist and change the status of the connection. I tried everything but failed to retrieve the sent text if I did not break the specific connection.

I control the ESP module with Arduino using the SoftwareSerial library, and I do the rest with AT commands.

https://github.com/aluis-rcastro/AI2_ANDROID_SIMPLE_TCP_CLIENT_EXTENSION/blob/master/bin/extension/ext.appinventor.ClientTCP.ClientTCP.aix
No I am not the author of the extension. Extension looks broken when upload it, but it works. If you have a suggestion to use other extension, say which one for my purpose.

you also can try

Taifun

1 Like

This extension work excellent. 10x Taifun !

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.