极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 12312|回复: 0

利用Esp8266 点对点传输数据 疑问交流

[复制链接]
发表于 2016-5-9 18:52:14 | 显示全部楼层 |阅读模式
本帖最后由 nikoava 于 2016-5-9 18:52 编辑

     利用esp8266作为wifi 发射站,将保存在nano的EEPROM内存中的温度数据传输到手提电脑或者手机上,设置 I 为地址,想通过修改I 最大值调节,来显示在网页上, 但无论我怎么修改 I 值,都只显示5个数据。求大神指教指教

  1. void sendMeasurement()  {
  2.     while(esp8266.available()) // check if the esp is sending a message
  3.   {
  4.     while(esp8266.find("+IPD,"))
  5.     {
  6.      delay(1000);

  7.      int connectionId = esp8266.read()-48; // 减去 48 because the read() function returns
  8.                                            // the ASCII 十进制值 and 0 (第一个十进制数) starts at 48
  9.                                           
  10.     String cipSend = "AT+CIPSEND=";//进入透传模式
  11.     cipSend += connectionId;
  12.     cipSend += ",";
  13.     cipSend += 28;
  14.     cipSend +="\r\n";
  15.     sendData(cipSend,200,DEBUG);

  16.     for(int i = 0; i < 30; i = i+2) {
  17.       //i 是地址
  18.     String webpage = String(EEPROM.read(i));
  19.     webpage +=",";
  20.     webpage += String(EEPROM.read(i+1));
  21.     webpage += "\r\n";   
  22.      
  23.     sendData(webpage,500,DEBUG);
  24.     //把数据打印出来到网页上
  25.    
  26.     }
  27.      String closeCommand = "AT+CIPCLOSE=";
  28.      closeCommand+=connectionId; // 附加 connection id
  29.      closeCommand+="\r\n";
  30.      
  31.      sendData(closeCommand,3000,DEBUG);
  32.     }
  33.   }
  34. }
复制代码



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 需要先绑定手机号

Archiver|联系我们|极客工坊

GMT+8, 2024-4-27 20:09 , Processed in 0.042229 second(s), 18 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表