完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
我正在从 github 的“easymesh”库上传下面给出的草图,它也在板管理器中显示它已安装......我收到错误,如“错误编译板通用 ESP8266 模块”作为板我是使用 ESP WROOM-02 以及 NodeMCU(ESP12-E)中的相同错误...如何纠正此问题...提前致谢...
代码:全选//************************************************************ // this is a simple example that uses the easyMesh library // // 1. blinks led once for every node on the mesh // 2. blink cycle repeats every BLINK_PERIOD // 3. sends a silly message to every node on the mesh at a random time betweew 1 and 5 seconds // 4. prints anything it recieves to Serial.print // // //************************************************************ #include // some gpio pin that is connected to an LED... // on my rig, this is 5, change to the right number of your LED. #define LED 5 // GPIO number of connected LED #define BLINK_PERIOD 1000000 // microseconds until cycle repeat #define BLINK_DURATION 100000 // microseconds LED is on for #define MESH_PREFIX \"whateverYouLike\" #define MESH_PASSWORD \"somethingSneeky\" #define MESH_PORT 5555 easyMesh mesh; uint32_t sendMessageTime = 0; void setup() { Serial.begin(115200); pinMode( LED, OUTPUT ); //mesh.setDebugMsgTypes( ERROR | MESH_STATUS | CONNECTION | SYNC | COMMUNICATION | GENERAL | MSG_TYPES | REMOTE ); // all types on mesh.setDebugMsgTypes( ERROR | STARTUP ); // set before init() so that you can see startup messages mesh.init( MESH_PREFIX, MESH_PASSWORD, MESH_PORT ); mesh.setReceiveCallback( &receivedCallback ); mesh.setNewConnectionCallback( &newConnectionCallback ); randomSeed( analogRead( A0 ) ); } void loop() { mesh.update(); // run the blinky bool onFlag = false; uint32_t cycleTime = mesh.getNodeTime() % BLINK_PERIOD; for ( uint8_t i = 0; i < ( mesh.connectionCount() + 1); i++ ) { uint32_t onTime = BLINK_DURATION * i * 2; if ( cycleTime > onTime && cycleTime < onTime + BLINK_DURATION ) onFlag = true; } digitalWrite( LED, onFlag ); // get next random time for send message if ( sendMessageTime == 0 ) { sendMessageTime = mesh.getNodeTime() + random( 1000000, 5000000 ); } // if the time is ripe, send everyone a message! if ( sendMessageTime != 0 && sendMessageTime < mesh.getNodeTime() ){ String msg = \"Hello from node \"; msg += mesh.getChipId(); mesh.sendBroadcast( msg ); sendMessageTime = 0; } } void receivedCallback( uint32_t from, String &msg ) { Serial.printf(\"startHere: Received from %d msg=%s\\n\", from, msg.c_str()); } void newConnectionCallback( bool adopt ) { Serial.printf(\"startHere: New Connection, adopt=%d\\n\", adopt); } 您是否首先成功尝试过任何标准 ESP8266 示例(例如闪烁)? |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
945 浏览 0 评论
1672 浏览 0 评论
请问一下我想用ESP8685直接替换ESP8266而不用写程序,可以让ESP8685直接通过之前ESP8266的外挂的flash运行程序吗
1330 浏览 1 评论
1233 浏览 1 评论
5021 浏览 2 评论
为blufi_device设置自定义名称,但是无法修改,为什么?
1253浏览 4评论
请问ESP32-S2-WROOM怎么获得ESP32-S2外接FLASH的唯一序列号?
927浏览 3评论
2336浏览 3评论
ESP-IDF的VScode插件的build按钮点击会报错的原因?
2526浏览 3评论
ESP-Jumpstart例程中第5个工程:5_cloud连接报错是哪里的问题?
1051浏览 2评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 03:09 , Processed in 2.562609 second(s), Total 69, Slave 52 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
481
