micropython / micropython-esp32

Old port of MicroPython to the ESP32 -- new port is at https://github.com/micropython/micropython
MIT License
669 stars 216 forks source link

ESP-Now #226

Closed nickzoic closed 6 years ago

nickzoic commented 6 years ago

Support for the ESP-Now protocol, as per #197

Sample code:

import network
import esp
w = network.WLAN()
w.active(True)
esp.espnow.init()
bcast = bytes([255,255,255,255,255,255])
esp.espnow.add_peer(w, bcast)
esp.espnow.set_recv_cb(lambda x: print("RECV %s %s" % x))
esp.espnow.set_send_cb(lambda x: print("SEND %s %s" % x))
esp.espnow.send(bcast, "hello, world")

The API could probably still use some work, but this is a first stab at it.

nickzoic commented 6 years ago

This, also, should be extended to cover the ESP32 and ESP8266 ports.

nickzoic commented 6 years ago

(I'm going to go create this over in the main project, so closing it here)