How about it? :-)
I see a library being started over here:
We're working on getting the documentation out there. In the meantime you can find it here: https://github.com/pycom/pycom-documentation/pull/387/files (near the bottom):
from network import WLAN from network import ESPNOW import binascii import time # The callback to be registered when a message has been sent to a Peer def espnow_tx(result): # "result" is the parameter in form of 2 element long tuple # "peer" is the Peer which the message has been sent to # "sent" is a boolean showing whether the message could be sent peer, sent = result mac = peer.addr() if(sent == False): print("Sending message to %s failed!" % binascii.hexlify(mac)) else: print("Message sent to: %s" % (binascii.hexlify(mac))) # The callback to be registered when a message has been received def espnow_rx(result): # "result" is the parameter in form of 3 element long tuple # "mac" is the MAC address of the sender # "peer" is the Peer which the message has been received from. If message has been received from a not registered Peer this parameter is None # "msg" is the payload from the received message mac, peer, msg = result if(peer is not None): print("Message received from %s with content: %s" % (binascii.hexlify(mac), msg)) peer.send("Sending back an answer") # The ESPNOW module needs that WLAN is initialized w = WLAN() # Initialize the ESPNOW module ESPNOW.init() # Register the callback which will be called on TX ESPNOW.on_send(espnow_tx) # Register the callback which will be called on RX ESPNOW.on_recv(espnow_rx) # Add a dedicated Peer with MAC address: 11:22:33:44:55:66 p = ESPNOW.add_peer("112233445566") # Send a message dedicated to the Peer p.send("My Message") # Sending 1 message to all Peers which are registered ESPNOW.send(None, "Hello all Peers!")
I'm interested in testing ESPNow, I have tried to create an ESPNOW interface instance following the example here https://github.com/glenn20/micropython/blob/espnow-g20/docs/library/espnow.rst
However the ESPNOW module is not callable;
from network import ESPNOW e=ESPNOW() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'module' object isn't callable
livius last edited by
yes, it is really usefull way to comunicate between boards :)
I was happy to see this is finally being added :-)
I may use this workaround: Configure an ESP8266 as an ESP-Now client and control it from the Wi-Py over UART.
seb last edited by
This is a feature we will be looking into but we don't have a specific date for when it might be available I am afraid.