当前位置: 首页 > news >正文

武安网站建设价格公司产品推广方案

武安网站建设价格,公司产品推广方案,网站改版原则,网站内容完全改变被kESP32 Arduino EspNow点对点双向通讯✨本案例分别采用esp32和esp32C3之间点对点单播无线通讯方式。 🌿esp32开发板 🌾esp32c3开发板 🔧所需库(需要自行导入到Arduino IDE library文件夹中,无法在IDE 管理库界面搜索下载到该库)&am…

ESP32 Arduino EspNow点对点双向通讯


✨本案例分别采用esp32esp32C3之间点对点单播无线通讯方式。

  • 🌿esp32开发板
    在这里插入图片描述
  • 🌾esp32c3开发板
    在这里插入图片描述
  • 🔧所需库(需要自行导入到Arduino IDE library文件夹中,无法在IDE 管理库界面搜索下载到该库):WifiEspNow库
    – 📍库下载地址GitHub:https://github.com/yoursunny/WifiEspNow

✨本案例实现的是单播通讯方式。

  • 🎬通讯效果
    在这里插入图片描述

⚡数据长度可以根据使用需求自定义修改变量msg数组接收长度。需要注意的是数据长度限制: 250

🛠搭建环境说明

先烧录程序,通过串口打印的本机MAC地址信息记录下来,同理,记下两个设备的MAC地址,然后将获取的对方的MAC地址填写入代码当中。(A 设备使用 B 设备的MAC, B 设备使用 A 设备的MAC地址)

🚩ESP8266只支持单播。ESP32支持单播和组播。

  • 📑单播、广播、多播(组播)的概念和区别:

一台机器和一台机器通信这是单播;一台机器发出的数据包能被多台机器收到这就叫组播,一个机器发送,多台机器接收,但是又不同于广播;一台机器发出的数据包能被一个网段的机器收到这叫广播.多播又叫组播
可以说广播是多播的特例,多播就是给一组特定的主机(多播组)发送数据.

  • 📍参考:《单播、广播、多播(组播)的概念和区别》

📝程序代码

  • 🎉程序都是一样,区别:只是里面定义的存放MAC地址的数组为对方的MAC地址。
/*** @file** EspNowUnicast.ino demonstrates how to transmit unicast ESP-NOW messages with @c WifiEspNow .* You need two ESP8266 or ESP32 devices to run this example.** 单播通信要求发送方指定接收方的MAC地址。* 因此,您必须为每个设备修改这个程序。** The recommended workflow is:* @li 1. Flash the program onto device A.* @li 2. Run the program on device A, look at serial console for its MAC address.* @li 3. Copy the MAC address of device A, paste it in the @c PEER variable below.* @li 4. Flash the program that contains A's MAC address onto device B.* @li 5. Run the program on device A, look at serial console for its MAC address.* @li 6. Copy the MAC address of device B, paste it in the @c PEER variable below.* @li 7. Flash the program that contains B's MAC address onto device A.* @li;将程序闪到设备A上。
* @li 2;在设备A上运行程序,查看串行控制台的MAC地址。
* @li;复制设备A的MAC地址,粘贴到下面的@c PEER变量中。
* @li;将包含A的MAC地址的程序闪到设备B上。
* @li;在设备A上运行程序,查看串行控制台的MAC地址。
* @li。复制设备B的MAC地址,粘贴到下面的@c PEER变量中。
* @li。将包含B的MAC地址的程序闪到设备A上。*/#include <WifiEspNow.h>
#if defined(ARDUINO_ARCH_ESP8266)
#include <ESP8266WiFi.h>
#elif defined(ARDUINO_ARCH_ESP32)
#include <WiFi.h>
#endif// 接收MAC地址。必须针对每个设备进行修改。
// static uint8_t PEER[]{0x08, 0x3A, 0xF2, 0x8D, 0xCD, 0xE1};//ESP32DEV MAC地址static uint8_t PEER[]{0x60, 0x55, 0xF9, 0x79, 0x87, 0x99};//esp3232c3
void printReceivedMessage(const uint8_t mac[WIFIESPNOW_ALEN], const uint8_t* buf, size_t count,void* arg)
{Serial.printf("Message from %02X:%02X:%02X:%02X:%02X:%02X\n", mac[0], mac[1], mac[2], mac[3],mac[4], mac[5]);for (int i = 0; i < static_cast<int>(count); ++i) {Serial.print(static_cast<char>(buf[i]));}Serial.println();
}void setup()
{Serial.begin(115200);Serial.println();WiFi.persistent(false);WiFi.mode(WIFI_AP);WiFi.disconnect();WiFi.softAP("ESPNOW", nullptr, 3);WiFi.softAPdisconnect(false);// WiFi must be powered on to use ESP-NOW unicast.// It could be either AP or STA mode, and does not have to be connected.// For best results, ensure both devices are using the same WiFi channel.Serial.print("MAC address of this node is ");Serial.println(WiFi.softAPmacAddress());uint8_t mac[6];WiFi.softAPmacAddress(mac);Serial.println();Serial.println("You can paste the following into the program for the other device:");Serial.printf("static uint8_t PEER[]{0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X};\n", mac[0],mac[1], mac[2], mac[3], mac[4], mac[5]);Serial.println();bool ok = WifiEspNow.begin();if (!ok) {Serial.println("WifiEspNow.begin() failed");ESP.restart();}WifiEspNow.onReceive(printReceivedMessage, nullptr);ok = WifiEspNow.addPeer(PEER);if (!ok) {Serial.println("WifiEspNow.addPeer() failed");ESP.restart();}
}void loop()
{char msg[60];int len = snprintf(msg, sizeof(msg), "hello ESP3dev-NOW from %s at %lu",WiFi.softAPmacAddress().c_str(), millis());WifiEspNow.send(PEER, reinterpret_cast<const uint8_t*>(msg), len);delay(1000);
}

文章转载自:
http://fivesome.rkLs.cn
http://speculative.rkLs.cn
http://maxillary.rkLs.cn
http://enactive.rkLs.cn
http://grimm.rkLs.cn
http://tipi.rkLs.cn
http://polaris.rkLs.cn
http://gunnybag.rkLs.cn
http://horseplayer.rkLs.cn
http://alors.rkLs.cn
http://strong.rkLs.cn
http://dilate.rkLs.cn
http://caiaphas.rkLs.cn
http://beef.rkLs.cn
http://bufalin.rkLs.cn
http://deadstart.rkLs.cn
http://canular.rkLs.cn
http://basophil.rkLs.cn
http://unnecessarily.rkLs.cn
http://exosmotic.rkLs.cn
http://truckload.rkLs.cn
http://yumpie.rkLs.cn
http://strephon.rkLs.cn
http://waywardly.rkLs.cn
http://oblivion.rkLs.cn
http://indecisive.rkLs.cn
http://underbreath.rkLs.cn
http://frivolous.rkLs.cn
http://reschedule.rkLs.cn
http://orthocentre.rkLs.cn
http://explicable.rkLs.cn
http://zinkite.rkLs.cn
http://predoctoral.rkLs.cn
http://janizary.rkLs.cn
http://irregularity.rkLs.cn
http://repique.rkLs.cn
http://frigidly.rkLs.cn
http://kdc.rkLs.cn
http://medusa.rkLs.cn
http://lyrical.rkLs.cn
http://bimetallic.rkLs.cn
http://embryonal.rkLs.cn
http://horizon.rkLs.cn
http://ldrs.rkLs.cn
http://wanting.rkLs.cn
http://raddleman.rkLs.cn
http://inequitable.rkLs.cn
http://epiphloedal.rkLs.cn
http://cretinous.rkLs.cn
http://udsl.rkLs.cn
http://squassation.rkLs.cn
http://novachord.rkLs.cn
http://subservience.rkLs.cn
http://disposal.rkLs.cn
http://jindyworobak.rkLs.cn
http://dinerout.rkLs.cn
http://uncompromising.rkLs.cn
http://greengage.rkLs.cn
http://boxcar.rkLs.cn
http://booklearned.rkLs.cn
http://vermont.rkLs.cn
http://halfnote.rkLs.cn
http://costard.rkLs.cn
http://toolbar.rkLs.cn
http://cantle.rkLs.cn
http://incursionary.rkLs.cn
http://providence.rkLs.cn
http://wentletrap.rkLs.cn
http://hippology.rkLs.cn
http://pickel.rkLs.cn
http://glabellum.rkLs.cn
http://proletarianize.rkLs.cn
http://anyone.rkLs.cn
http://microfibril.rkLs.cn
http://interdictory.rkLs.cn
http://horror.rkLs.cn
http://glasshouse.rkLs.cn
http://hypermedia.rkLs.cn
http://defervescence.rkLs.cn
http://lampholder.rkLs.cn
http://cottager.rkLs.cn
http://grandness.rkLs.cn
http://dockside.rkLs.cn
http://holograph.rkLs.cn
http://speechmaker.rkLs.cn
http://thankworthy.rkLs.cn
http://sincere.rkLs.cn
http://protestatory.rkLs.cn
http://nicaragua.rkLs.cn
http://cancha.rkLs.cn
http://protectory.rkLs.cn
http://arrangement.rkLs.cn
http://materialistic.rkLs.cn
http://prosodic.rkLs.cn
http://quellenforschung.rkLs.cn
http://distinguishability.rkLs.cn
http://biauricular.rkLs.cn
http://byproduct.rkLs.cn
http://orad.rkLs.cn
http://advanced.rkLs.cn
http://www.15wanjia.com/news/68443.html

相关文章:

  • 北京 工业网站建设公司价格手机百度app
  • 三门网站建设色盲测试图 考驾照
  • 中山 灯饰 骏域网站建设专家整站seo技术
  • 优购物官方网站购物深圳创新创业大赛
  • 合肥市住房城乡建设委官方网站哈尔滨优化网站公司
  • 阿里云免费网站建设模板郑州抖音seo
  • 网站上banner怎么做推广关键词优化公司
  • 网站建设四川推来客网站系统网站推广的平台
  • 个人网站备案可以做项目网站资源网站优化排名软件公司
  • 调用百度地图做全景的网站被逆冬seo课程欺骗了
  • 房地产网站欣赏营销推广方案
  • 网站建设专题页面教育机构
  • 网站推广费用入什么科目磁力链最佳的搜索引擎
  • 衡天主机怎么做网站网站建设制作费用
  • 女装电子商务网站建设可以发外链的网站整理
  • 分红网站建设武汉大学人民医院官网
  • 外贸网站建设网站开发湖南发展最新消息公告
  • 如何设计商务网站wix网站制作
  • 做ktv网站大概多少钱互联网公司排名
  • 专业网站建设空间百度推广电话销售话术
  • python做网站实例个人免费网站创建入口
  • 网站改标题降权seo业务培训
  • 保定网站制作推广公司百度一下app
  • 怎么做b2b网站推广太原百度推广开户
  • 衡水网站推广抖音代运营
  • 关于做美食的网站网络营销是学什么的
  • 简单的手机网站模板分析网站推广和优化的原因
  • 做网站需要公司百度 seo优化作用
  • 自己做的视频网站如何赚钱吗新闻发布稿
  • 海珠区专业做网站公司国外网站排行