ESP-NOW

Using ESP-NOW technology to wirelessly transmit data to other ESP32 master control devices

import espnow

//initialization
espnow.init()

//Set the channel

//Get the local mac_addr
espnow.get_mac_addr()

//broadcast
espnow.broadcast(data='Hello')

//Set the peer list
espnow.add_peer(slave_mac_addr, id)

//send messages
espnow.send(id, data='World')

//Send message callback
def send_cb(flag):
  if flag:
    print('succeed')
  else:
    print('Failed')

espnow.send_cb(send_cb)

//Receive message callback
def recv_cb():
    //retrieve data
    sender_address, _, receive_data = espnow.recv_data(encoder='str')

espnow.recv_cb(recv_cb)
On This Page