hi
Links
https://randomnerdtutorials.com/how-to-make-two-esp8266-talk/
https://www.instructables.com/id/WiFi-Communication-Between-Two-ESP8266-Based-MCU-T/
https://www.instructables.com/id/Accesspoint-Station-Communication-Between-Two-ESP8/
https://www.microcontroller-project.com/esp8266-inter-communication-using-arduino-ide.html
https://circuits4you.com/2018/01/01/esp-to-esp-communication/
videos
https://www.youtube.com/watch?v=gZhUi24_qms
Hope it helps
377/5000
Hi:
I want to make a simple connection with two esp8266 when the first is a client and the second is a server without using anything else.
I found a simple code to connect this but it does not run when assigning the socket, on the client, s = socket.socket (af, socktype, proto).
It doesn’t run when the server is an esp8266 but it runs if the server is my computer.
The code in the server is:
def conexion():
s=conecta()
count = 0
while True:
conn, addr = s.accept()
count = count + 1
conn.send(b’HTTP/1.1 200 OK\n’)
conn.send(b’Content-Type: text/html\n’)
conn.send(b’Connection: close\n\n’) tx1 = “””<html><head> <meta name=”viewport” content=”width=device-width, initial-scale=1″> </head><body><h3>Conectado con dispositivo…</h3>”””+str(count) conn.sendall(tx1) conn.sendall(tx1) print(“Conectado {} veces”.format(count))
request = conn.recv(1024)
conn.close()
def conecta():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM,0)
s.bind((”, 80))
s.listen(5)
return s
def creared(): ap = network.WLAN(network.AP_IF) ap.active(True)
ap.config(essid=’RED1PR’, password=’12345678′)
if __name__ == “__main__”:
creared()
conexion()
The code client is:
def conecta(HOST):
PORT=80
for res in socket.getaddrinfo(HOST, PORT):
af, socktype, proto, canonname, sa = res
try:
s = socket.socket(af, socktype, proto) #—>>> NOT CONNECT
except OSError as msg:
print(‘Error de creacion Socket ‘,msg)
continue
try:
s.connect(sa)
return s
except OSError as msg:
s.close()
return s
def creared():
essid=’RED1PR’
password=’12345678′
station = network.WLAN(network.STA_IF)
station.active(True)
station.connect(essid, password)
while station.isconnected()==False:
continue
st=station.ifconfig()
return st[3]
if __name__ == “__main__”:
s=conecta(creared())