完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我试图让我的 esp8266 网络服务器定期休眠,但找不到实现后台计时器的好方法,我希望计时器在有人连接到服务器时停止计数。
我能想到的最好的主意是: 代码:全选 #include #include void setup(void){ /* initialize the wifi and web server */ timer.start(1 hour);//initialize and start the timer and let it count to 1 hour for example } void loop(void){ if(server.client().connected()){ timer.restart(1 hour); //restart the timer so it won't sleep when other users are connected } server.handleClient(); // the timer is still counting in background if(timer.count==1 hour ){ ESP.deepSleep(sometime); // let the server sleep if no one connects it for 1 hour } } |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
180个成员聚集在这个小组
加入小组453 浏览 1 评论
1450 浏览 1 评论
618浏览 6评论
514浏览 5评论
有没有办法在不使用混杂模式的情况下实现Wifi驱动程序接收缓冲区访问中断呢?
494浏览 5评论
496浏览 4评论
486浏览 4评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-2-2 14:00 , Processed in 0.825237 second(s), Total 75, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号