ESP8266 ESP NOW

来自Jack's Lab
跳转到: 导航, 搜索

1 概述

所谓 ESP NOW 就是乐鑫官方为智能照明应用提供的集群控制功能




2 快速尝试

准备两片 Noduino Falcon 开发板 或 nodemcu v1.0 开发板,USB 连上 PC


下载 SDK:

# clone the whole sdk
$ git clone git://github.com/icamgo/noduino-sdk.git noduino-sdk

# fetch the toolchain of esp8266
$ cd noduino-sdk
$ git submodule init
$ git submodule update
$ cd toolchain
$ ./gen.py
# generate the toolchain (you need Python 2.7)


插上开发板,刷上 ctrl:

$ cd ../example/esp-now/ctrl

$ make flash


插上另外一片开发板,刷上 slave:

$ cd ../example/esp-now/slave

$ make flash


完成后,查看各自的串口输出



3 SDK API

在 ctrl 端不管 slave 是否通电在线:

  • esp_now_set_peer_channel(slave_mac, c_ch);
  • esp_now_get_peer_channel(slave_mac);

这些都会成功,貌似只是设置 ctrl 端的记录条目


  • esp_now_set_peer_role(slave_mac, ESP_NOW_ROLE_SLAVE); 在 ctrl 边,调用常常失败,建议慎用






























个人工具
名字空间

变换
操作
导航
工具箱