Code: Select all
e.send(local, msg, sync=True)
TypeError: function doesn't take keyword arguments
so I just changed it to
e.send(local, msg)
Code: Select all
# ESPNow repeater
import network
from esp import espnow
import utime
# A WLAN interface must be active to send()/recv()
w0 = network.WLAN(network.STA_IF)
w0.active(True)
mac = w0.config('mac')
print (mac)
e0 = espnow.ESPNow()
print (e0)
retval = e0.init()
if (retval != None):
print ('init() did NOT work')
machine.reset()
local = b'\x08:\xf2\xacj\xe4'
remote = b'\x08:\xf2\xab\xe2\x0c'
retval = e0.add_peer(local)
if (retval != None):
print ('add peer did NOT work')
machine.reset()
while True:
print ('waiting for msg')
for mac, msg in e0:
if mac == remote:
wanted_msg = msg.decode('utf-8')
print (wanted_msg)
e0.send(local, msg, True) # corrected
else:
print ('Recv from {}: "{}"'.format(mac, msg))