logo elektroda
logo elektroda
X
logo elektroda

ESP8266 - Two-way communication via TCP server in Arduino IDE

@Kamil 5832 6
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 15578783
    @Kamil
    Level 23  
    Hello,
    I have a small question. I want to transfer data between two ESP8266. The working principle is supposed to be trivial. The ESP is supposed to react to a button being pressed and send data to the other ESP. The only thing is that this is supposed to be done both ways(there is supposed to be a button for each esp) From what I have read I would like to program this in the Arduino IDE. I just have a question if my concept is right. If I set up a TCP server on both ESPs, can communication be two way? Or is there another method to do this? I am not looking for a ready-made solution, just hints.
    Thank you in advance for your answers.
  • ADVERTISEMENT
  • #2 15579064
    tmf
    VIP Meritorious for electroda.pl
    And why a TCP server and an arduino? You upload the program directly to the ESP, do the communication on UDP and the matter is settled.
  • ADVERTISEMENT
  • #3 15579101
    @Kamil
    Level 23  
    I was more concerned with programming the ESP itself using the Arduino IDE, unless there is a better method?
    That is, I just need to create a UDP server on the two ESPs, should there be a server on one and a client on the other. Just not sure if it is then possible to send something from the server to the client?
    I think I'm a bit confused.
  • ADVERTISEMENT
  • #4 15583050
    szaro
    Level 19  
    All you need is NodeMCU and a few lines of code in LUA.
  • ADVERTISEMENT
  • Helpful post
    #5 15583533
    piotrva
    VIP Meritorious for electroda.pl
    1. Yes ESP8266 is nice to program in Arduino.
    2. On each ESP you create yourself an udp "server" (listening) which does not conflict with the same esp transmitting something over UDP for others.
  • #6 15583558
    @Kamil
    Level 23  
    Thank you for your help.
    I have already tested the communication over UDP using AT commands and everything works as I would like it to.
    Now I just need to port it to an arduino, but I need to brush up a bit as I've never written anything on an arduino.
  • #7 15585532
    piotr411
    Level 22  
    You don't have to look far, here an example of communication between 3 ESPs written in Basic ESP.
    even cooler example ESP ESP
ADVERTISEMENT