ESP8266 WiFi
ESP8266 WiFi 库
The WiFi class initializes the ethernet library and network settings.
- WiFi.mode()
设置wifi模块工作模式WIFI_AP,WIFI_STA,WIFI_AP_STA
ESP8266WiFi AP - WiFi.softAP(ssid,[password],[channel],[ssid_hidden]) 设置AP模式参数 参数
返回值:bool - WiFi.softAPConfig(local_ip,gateway,subnet) 配置AP 参数
返回值:bool - WiFi.softAPdisconnect(wifioff) 断开网络,关闭AP - WiFi.softAPgetStationNum() Get the count of the Station / client that are connected to the softAP interface - WiFi.softAPIP() 获取IP地址,用于AP模式 返回:IP地址 - WiFi.softAPmacAddress(mac) 获取MAC地址,用于AP模式 返回:uint8_t* - WiFi.softAPmacAddress(void) 获取MAC地址,用于AP模式 返回:String |
ESP8266WiFi STA WL_CONNECTED WL_NO_SSID_AVAIL WL_CONNECT_FAILED WL_IDLE_STATUS WL_DISCONNECTED - WiFi.begin() 开始wifi连接 - WiFi.config(local_ip, gateway, subnet, dns1, dns2) Change IP configuration settings disabling the dhcp client 参数
返回:bool - WiFi.reconnect() will force a disconnect and then start reconnecting to AP 返回:bool - WiFi.disconnect(bool wifioff) Disconnect from the network 返回:bool - WiFi.isConnected() 检查是否已连接 返回:bool - WiFi.setAutoConnect(bool autoConnect) 设置是否复位自动连接,默认自动连接 返回:bool - WiFi.setAutoConnect() 检查是否设置了复位自动连接 返回:bool - WiFi.setAutoReconnect(bool autoReconnect) 设置当连接断开时是否重新连接 返回:bool - WiFi.waitForConnectResult() Wait for WiFi connection to reach a result returns the status reached or disconnect if STA is off 返回:连接状态
- WiFi.localIP() 获取IP地址,用于STA模式 返回:IPAddress - WiFi.macAddress(uint8_t* mac) 获取MAC地址,用于STA模式 返回:uint8_t* - WiFi.macAddress(void) 获取MAC地址,用于STA模式 返回:String - WiFi.subnetMask() Get the interface subnet mask address. 返回:IPAddress - WiFi.gatewayIP() Get the gateway ip address. 返回:IPAddress - WiFi.dnsIP(uint8_t dns_no) Get the DNS ip address. 返回:IPAddress - WiFi.hostname(void) Get ESP8266 station DHCP hostname 返回:String - WiFi.hostname(char* aHostname) Set ESP8266 station DHCP hostname 返回:bool - WiFi.hostname(const char* aHostname) Set ESP8266 station DHCP hostname 返回:bool - WiFi.hostname(String aHostname) Set ESP8266 station DHCP hostname 返回:bool - WiFi.SSID() 获取当前连接网络的SSID 返回:String - WiFi.psk() 获取当前连接网络的共享秘钥 返回:String - WiFi.BSSID(void) Return the current bssid / mac associated with the network if configured 返回:uint8_t* - WiFi.BSSIDstr(void) Return the current bssid / mac associated with the network if configured 返回:String - WiFi.RSSI(void) Return the current network RSSI. 返回:int32_t (RSSI value) STA远程配置 - WiFi.beginWPSConfig(void) WPS配置(so far only WPS_TYPE_PBC is supported (SDK 1.2.0)) 返回:bool - WiFi.beginSmartConfig() 开始 SmartConfig 返回:bool - WiFi.stopSmartConfig() 停止 SmartConfig 返回:bool - WiFi.smartConfigDone() 查询 SmartConfig 状态,决定何时停止配置 返回:bool
|
ESP8266WiFi Server The Server class creates servers which can send data to and receive data from connected clients (programs running on other computers or devices).
- WiFiServer(IPAddress addr, uint16_t port) 开启服务 参数
- WiFiServer(uint16_t port) 开启服务 参数
- WiFi.begin() 开始 SmartConfig
- WiFi.available() 开始 SmartConfig
|
ESP8266WiFi Client The client class creates clients that can connect to servers and send and receive data.
|
ESP8266WiFi Udp The UDP class enables UDP message to be sent and received. |
更多建议和问题欢迎反馈至 YFRobot论坛