《博哥ESP8266系列4》 - 局域网:ESP8266+路由+RGB彩灯+App-Arduino中文社区 - Powered by Discuz!

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

楼主: 单片机菜鸟

《博哥ESP8266系列4》- 局域网:ESP8266+路由+RGB彩灯+App

  [复制链接]
 楼主| 发表于 2018-3-8 17:05 | 显示全部楼层
15873889685 发表于 2018-3-8 17:02
for (i = 0; i < MAX_SRV_CLIENTS; i++){
        if (serverClients && serverClients.connected( ...

首先数组肯定不能调用方法吧 方法都是针对对象的  serverClients.connected()   serverClients.available()
 楼主| 发表于 2018-3-8 17:05 | 显示全部楼层

后面那几个也加上i
发表于 2018-3-8 17:07 | 显示全部楼层

加了一样不行?
 楼主| 发表于 2018-3-8 17:10 | 显示全部楼层

加了不行  有提示什么错误吗
发表于 2018-3-8 17:11 | 显示全部楼层
单片机菜鸟 发表于 2018-3-8 17:10
加了不行  有提示什么错误吗

Arduino:1.6.5 (Windows 8.1), 板:"NodeMCU 0.9 (ESP-12 Module), 80 MHz, 115200, 4M (3M SPIFFS)"

sketch_mar08c.ino: In function 'void loop()':
sketch_mar08c:55: error: request for member 'connected' in 'serverClients', which is of non-class type 'WiFiClient [3]'
sketch_mar08c:56: error: request for member 'stop' in 'serverClients', which is of non-class type 'WiFiClient [3]'
sketch_mar08c:56: error: 'ii' was not declared in this scope
sketch_mar08c:57: error: invalid conversion from 'uint8_t {aka unsigned char}' to 'uint8_t* {aka unsigned char*}' [-fpermissive]
In file included from C:\Users\shenghui\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/ESP8266WiFi.h:40:0,
                 from sketch_mar08c.ino:6:
C:\Users\shenghui\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiServer.h:51:14: error:   initializing argument 1 of 'WiFiClient WiFiServer::available(uint8_t*)' [-fpermissive]
   WiFiClient available(uint8_t* status = NULL);
              ^
sketch_mar08c:62: error: invalid conversion from 'uint8_t {aka unsigned char}' to 'uint8_t* {aka unsigned char*}' [-fpermissive]
In file included from C:\Users\shenghui\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/ESP8266WiFi.h:40:0,
                 from sketch_mar08c.ino:6:
C:\Users\shenghui\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiServer.h:51:14: error:   initializing argument 1 of 'WiFiClient WiFiServer::available(uint8_t*)' [-fpermissive]
   WiFiClient available(uint8_t* status = NULL);
              ^
sketch_mar08c:62: error: variable-sized object 'serverClient' may not be initialized
sketch_mar08c:64: error: request for member 'stop' in 'serverClient', which is of non-class type 'WiFiClient [(((sizetype)(((ssizetype)i) + -1)) + 1)]'
sketch_mar08c:69: error: request for member 'connected' in 'serverClients', which is of non-class type 'WiFiClient [3]'
sketch_mar08c:71: error: request for member 'available' in 'serverClients', which is of non-class type 'WiFiClient [3]'
sketch_mar08c:72: error: request for member 'available' in 'serverClients', which is of non-class type 'WiFiClient [3]'
sketch_mar08c:73: error: request for member 'read' in 'serverClients', which is of non-class type 'WiFiClient [3]'
request for member 'connected' in 'serverClients', which is of non-class type 'WiFiClient [3]'

  报告将会包含更多的信息
  "在编译时,输出详细信息"
  在 文件>首选项 中启用
 楼主| 发表于 2018-3-8 17:12 | 显示全部楼层

你前面那个都改对了  为毛后面那几个改错了    。。。。。。数组啊数组啊  为什么i放到了函数的参数里面去了呢
发表于 2018-3-8 17:15 | 显示全部楼层
单片机菜鸟 发表于 2018-3-8 17:12
你前面那个都改对了  为毛后面那几个改错了    。。。。。。数组啊数组啊  为什么i放到了函数的参数里面 ...

啥意思?i我就放在serverClients【i】,serverClients.connected(i),,serverClients.available(i)里面
 楼主| 发表于 2018-3-8 17:16 | 显示全部楼层
15873889685 发表于 2018-3-8 17:15
啥意思?i我就放在serverClients【i】,serverClients.connected(i),,serverClients.available(i)里面 ...

。。。。你先去理解一下什么叫做数组   然后怎么引用数组里面的元素  貌似你弄混了概念
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|Archiver|手机版|Arduino中文社区

GMT+8, 2024-11-28 02:38 , Processed in 0.159229 second(s), 14 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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