查看ESP8266 WiFi的源代码
←
ESP8266 WiFi
跳转至:
导航
、
搜索
因为以下原因,你没有权限编辑本页:
你刚才请求的操作只对属于该用户组的用户开放:
用户
您可以查看并复制此页面的源代码:
==<font color="orange" size="+2">'''ESP8266 WiFi 库'''</font>== <br> '''The WiFi class initializes the ethernet library and network settings.''' - <font color="forestgreen">WiFi.mode()</font> 设置wifi模块工作模式WIFI_AP,WIFI_STA,WIFI_AP_STA {| border="0" cellpadding="10" width="100%" |width="50%" valign="top" align="left"| <font color="orange" size="+1">ESP8266WiFi AP</font><br> - <font color="forestgreen">WiFi.softAP(ssid,[password],[channel],[ssid_hidden])</font> 设置AP模式参数 参数 :ssid:网络名称(最长63字符) :password:密码,至少8个字符,NULL为开放网络(可选参数) :channel:通道号,1 - 13(可选参数,缺省情况下为1) :ssid_hidden:网络是否可见,0为可见网络,1为隐藏网络(可选参数,缺省情况下为0) 返回值:bool - <font color="forestgreen">WiFi.softAPConfig(local_ip,gateway,subnet)</font> 配置AP 参数 :local_ip:ap ip(类型:IPAddress-例192,168,0,1) :gateway:网关ip(类型:IPAddress) :subnet:子网掩码(类型:IPAddress) 返回值:bool - <font color="forestgreen">WiFi.softAPdisconnect(wifioff)</font> 断开网络,关闭AP - <font color="forestgreen">WiFi.softAPgetStationNum()</font> 获取AP模式下已连接终端的数量 - <font color="forestgreen">WiFi.softAPIP()</font> 获取IP地址,用于AP模式 返回:IP地址 - <font color="forestgreen">WiFi.softAPmacAddress(mac)</font> 获取MAC地址,用于AP模式 返回:uint8_t* - <font color="forestgreen">WiFi.softAPmacAddress(void)</font> 获取MAC地址,用于AP模式 返回:String <!---------------------------------------------------ESP8266 wifi sta---------------------------------------------------------------------> |width="50%" valign="top" align="left"| <font color="orange" size="+1">ESP8266WiFi STA</font><br> WL_CONNECTED WL_NO_SSID_AVAIL WL_CONNECT_FAILED WL_IDLE_STATUS WL_DISCONNECTED - <font color="forestgreen">WiFi.begin()</font> 开始wifi连接 - <font color="forestgreen">WiFi.config(local_ip, gateway, subnet, dns1, dns2)</font> 更改IP配置设置禁用DHCP客户端 参数 : local_ip Static ip configuration : gateway Static gateway configuration : subnet Static Subnet mask : dns1 Static DNS server 1 : dns2 Static DNS server 2 返回:bool - <font color="forestgreen">WiFi.reconnect()</font> 将强制断开连接,然后重新连接到AP 返回:bool - <font color="forestgreen">WiFi.disconnect(bool wifioff)</font> Disconnect from the network 断开网络 返回:bool - <font color="forestgreen">WiFi.isConnected()</font> 检查是否已连接 返回:bool - <font color="forestgreen">WiFi.setAutoConnect(bool autoConnect)</font> 设置是否复位自动连接,默认自动连接 返回:bool - <font color="forestgreen">WiFi.getAutoConnect()</font> 检查是否设置了复位自动连接 返回:bool - <font color="forestgreen">WiFi.setAutoReconnect(bool autoReconnect)</font> 设置当连接断开时是否重新连接 返回:bool - <font color="forestgreen">WiFi.waitForConnectResult()</font> Wait for WiFi connection to reach a result returns the status reached or disconnect if STA is off 返回:连接状态 :WL_CONNECTED :WL_NO_SSID_AVAIL; :WL_CONNECT_FAILED; :WL_IDLE_STATUS; :WL_DISCONNECTED; - <font color="forestgreen">WiFi.localIP()</font> 获取IP地址,用于STA模式 返回:IPAddress - <font color="forestgreen">WiFi.macAddress(uint8_t* mac)</font> 获取MAC地址,用于STA模式 返回:uint8_t* - <font color="forestgreen">WiFi.macAddress(void)</font> 获取MAC地址,用于STA模式 返回:String - <font color="forestgreen">WiFi.subnetMask()</font> Get the interface subnet mask address. 获取接口子网掩码地址 返回:IPAddress - <font color="forestgreen">WiFi.gatewayIP()</font> Get the gateway ip address. 获取网关地址 返回:IPAddress - <font color="forestgreen">WiFi.dnsIP(uint8_t dns_no)</font> Get the DNS ip address. 获取DNS ip 地址 返回:IPAddress - <font color="forestgreen">WiFi.hostname(void)</font> Get ESP8266 station DHCP hostname 获取ESP8266 SAT DHCP主机名 返回:String - <font color="forestgreen">WiFi.hostname(char* aHostname)</font> Set ESP8266 station DHCP hostname 设置ESP8266 STA DHCP主机名 参数类型:char* 返回:bool - <font color="forestgreen">WiFi.hostname(const char* aHostname)</font> Set ESP8266 station DHCP hostname 参数类型:const char* 返回:bool - <font color="forestgreen">WiFi.hostname(String aHostname)</font> Set ESP8266 station DHCP hostname 参数类型:String 返回:bool - <font color="forestgreen">WiFi.SSID()</font> 获取当前连接网络的SSID 返回:String - <font color="forestgreen">WiFi.psk()</font> 获取当前连接网络的共享秘钥 返回:String - <font color="forestgreen">WiFi.BSSID(void)</font> Return the current bssid / mac associated with the network if configured 返回:uint8_t* - <font color="forestgreen">WiFi.BSSIDstr(void)</font> Return the current bssid / mac associated with the network if configured 返回:String - <font color="forestgreen">WiFi.RSSI(void)</font> Return the current network RSSI. 返回:int32_t (RSSI value) <font color="deepskyblue" size="+0.5">STA远程配置</font><br> - <font color="forestgreen">WiFi.beginWPSConfig(void)</font> WPS配置(so far only WPS_TYPE_PBC is supported (SDK 1.2.0)) 返回:bool - <font color="forestgreen">WiFi.beginSmartConfig()</font> 开始 SmartConfig 返回:bool - <font color="forestgreen">WiFi.stopSmartConfig()</font> 停止 SmartConfig 返回:bool - <font color="forestgreen">WiFi.smartConfigDone()</font> 查询 SmartConfig 状态,决定何时停止配置 返回:bool <br> |} <!--------------------------------------------------------------ESP8266 wifi server---------------------------------------------------------------> {| border="0" cellpadding="10" width="100%" |width="33%" valign="top" align="left"| <font color="orange" size="+1">ESP8266WiFi Server</font><br> '''The Server class creates servers which can send data to and receive data from connected clients (programs running on other computers or devices).''' - <font color="forestgreen">WiFiServer(IPAddress addr, uint16_t port)</font> 开启服务 参数 :addr:ip地址 :port:端口 - <font color="forestgreen">WiFiServer(uint16_t port)</font> 开启服务 参数 :port:端口 - <font color="forestgreen">WiFi.begin()</font> - <font color="forestgreen">WiFi.setNoDelay(bool nodelay)</font> - <font color="forestgreen">WiFi.getNoDelay()</font> - <font color="forestgreen">WiFi.hasClient()</font> - <font color="forestgreen">WiFi.available()</font> - <font color="forestgreen">WiFi.status()</font> - <font color="forestgreen">WiFi.close()</font> - <font color="forestgreen">WiFi.stop()</font> - <font color="forestgreen">WiFi.write(uint8_t b)</font> - <font color="forestgreen">WiFi.write(const uint8_t *buffer, size_t size)</font> <br> <!-------------------------------------------------------------ESP8266 wifi client----------------------------------------------------------------> |width="33%" valign="top" align="left"| <font color="orange" size="+1">ESP8266WiFi Client</font><br> '''The client class creates clients that can connect to servers and send and receive data.''' - <font color="forestgreen">WiFi.WiFiClient()</font> - <font color="forestgreen">WiFi.WiFiClient(const WiFiClient& other)</font> - <font color="forestgreen">WiFi.operator=(const WiFiClient& other)</font> - <font color="forestgreen">WiFi.connect(const char* host, uint16_t port)</font> - <font color="forestgreen">WiFi.connect(IPAddress ip, uint16_t port)</font> - <font color="forestgreen">WiFi.setNoDelay(bool nodelay)</font> - <font color="forestgreen">WiFi.getNoDelay()</font> - <font color="forestgreen">WiFi.write(uint8_t b)</font> - <font color="forestgreen">WiFi.write(const uint8_t *buf, size_t size)</font> - <font color="forestgreen">WiFi.write_P(PGM_P buf, size_t size)</font> - <font color="forestgreen">WiFi.available()</font> - <font color="forestgreen">WiFi.read()</font> - <font color="forestgreen">WiFi.read(uint8_t* buf, size_t size)</font> - <font color="forestgreen">WiFi.peekBytes(uint8_t *buffer, size_t length)</font> - <font color="forestgreen">WiFi.flush()</font> - <font color="forestgreen">WiFi.stop()</font> - <font color="forestgreen">WiFi.connected()</font> - <font color="forestgreen">WiFi.status()</font> - <font color="forestgreen">WiFi.remoteIP()</font> - <font color="forestgreen">WiFi.remotePort()</font> - <font color="forestgreen">WiFi.localIP()</font> - <font color="forestgreen">WiFi.localPort()</font> - <font color="forestgreen">WiFi.stopAll()</font> - <font color="forestgreen">WiFi.stopAllExcept(WiFiClient * exC)</font> <br><br> <!---------------------------------------------------------------ESP8266 wifi udp--------------------------------------------------------------> |width="33%" valign="top" align="left"| <font color="orange" size="+1">ESP8266WiFi Udp</font><br> '''The UDP class enables UDP message to be sent and received.''' - <font color="forestgreen">WiFi.WiFiUDP(const WiFiUDP& other)</font> - <font color="forestgreen">WiFi.begin(uint16_t port)</font> - <font color="forestgreen">WiFi.beginMulticast(IPAddress interfaceAddr, IPAddress multicast, uint16_t port)</font> - <font color="forestgreen">WiFi.available()</font> - <font color="forestgreen">WiFi.stop()</font> - <font color="forestgreen">WiFi.beginPacket(const char *host, uint16_t port)</font> - <font color="forestgreen">WiFi.beginPacket(IPAddress ip, uint16_t port)</font> - <font color="forestgreen">WiFi.beginPacketMulticast(IPAddress multicastAddress, uint16_t port,IPAddress interfaceAddress, int ttl)</font> - <font color="forestgreen">WiFi.endPacket()</font> - <font color="forestgreen">WiFi.write(uint8_t byte)</font> - <font color="forestgreen">WiFi.write(const uint8_t *buffer, size_t size)</font> - <font color="forestgreen">WiFi.parsePacket()</font> - <font color="forestgreen">WiFi.read()</font> - <font color="forestgreen">WiFi.read(unsigned char* buffer, size_t len)</font> - <font color="forestgreen">WiFi.peek()</font> - <font color="forestgreen">WiFi.flush()</font> - <font color="forestgreen">WiFi.remoteIP()</font> - <font color="forestgreen">WiFi.remotePort()</font> - <font color="forestgreen">WiFi.destinationIP()</font> - <font color="forestgreen">WiFi.localPort()</font> - <font color="forestgreen">WiFi.stopAll()</font> - <font color="forestgreen">WiFi.stopAllExcept(WiFiUDP * exC)</font> |} ---- [[ESP8266 Libraries|返回ESP8266 Libraries]] [[首页|返回首页]] 更多建议和问题欢迎反馈至 [http://www.yfrobot.com YFRobot论坛]
返回
ESP8266 WiFi
。
导航菜单
个人工具
登录
名字空间
页面
讨论
不转换
变种
不转换
简体
繁體
大陆简体
香港繁體
澳門繁體
大马简体
新加坡简体
台灣正體
查看
阅读
查看源代码
查看历史
操作
搜索
导航
首页
YF-论坛提问
YFRobot-直营店
YFRobot-企业店
Arduino
Arduino之入门篇
Arduino入门教程
Arduino语法参考
Arduino库
Arduino核心代码
编程平台
Mixly库
Mind+库
MakeCode扩展
传感器系列
积木式传感器系列
黑板传感器系列
蓝板传感器系列
Micro:Bit
Micro:Bit 通用基础教程
Valon智能车
Valon-I
帮助
帮助
wiki语法参考
工具箱
链入页面
相关更改
特殊页面
页面信息