WiFi库

来自YFRobotwiki
2016年3月24日 (四) 16:36Admin讨论 | 贡献的版本

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航搜索


The firmware for the WiFi shield has changed in Arduino IDE 1.0.5. You are recommended to install this update per these instructions With the Arduino WiFi Shield, this library allows an Arduino board to connect to the internet. It can serve as either a server accepting incoming connections or a client making outgoing ones. The library supports WEP and WPA2 Personal encryption, but not WPA2 Enterprise. Also note, if the SSID is not broadcast, the shield cannot connect. Arduino communicates with the WiFi shield using the SPI bus. This is on digital pins 11, 12, and 13 on the Uno and pins 50, 51, and 52 on the Mega. On both boards, pin 10 is used as SS. On the Mega, the hardware SS pin, 53, is not used but it must be kept as an output or the SPI interface won't work. Digital pin 7 is used as a handshake pin between the Wifi shield and the Arduino, and should not be used. The WiFi library is very similar to the Ethernet library, and many of the function calls are the same. For additional information on the WiFi shield, see the Getting Started page and the WiFi shield hardware page.


示例


- ConnectNoEncryption: Demonstrates how to connect to an open network
- ConnectWithWEP: Demonstrates how to connect to a network that is encrypted with WEP
- ConnectWithWPA: Demonstrates how to connect to a network that is encrypted with WPA2 Personal
- ScanNetworks: Displays all WiFi networks in range
- WiFiChatServer: Set up a simple chat server
- WiFiWebClient: Connect to a remote webserver
- WiFiWebClientRepeating: Make repeated HTTP calls to a webserver
- WiFiWebServer: Serve a webpage from the WiFi shield
- WiFiSendReceiveUDPString: Send and receive a UDP string
- UdpNTPClient: Query a Network Time Protocol (NTP) server using UDP




WiFi类

The WiFi class initializes the ethernet library and network settings.

- begin()
- disconnect()
- config()
- setDNS()
- SSID()
- BSSID()
- RSSID()
- encryptionType()
- scanNetworks()
- status()
- getSocket()
- macAddress()



IPAddress类

The IPAddress class provides information about the network configuration.

- localIP()
- subnetMask()
- gatewayIP()



Server 类

The Server class creates servers which can send data to and receive data from connected clients (programs running on other computers or devices).

- Server
- WiFiServer
- begin()
- available()
- write()
- print()
- println()



Client 类

The client class creates clients that can connect to servers and send and receive data.

- Client
- WiFiClient()
- connected()
- connect()
- write()
- print()
- println()
- available()
- read()
- flush()
- stop()



UDP 类

The UDP class enables UDP message to be sent and received.

-WiFiUDP
-begin()
-available()
-beginPacket()
-endPacket()
-write()
-parsePacket()
-peek()
-read()
-flush()
-stop()
-remoteIP()
-remotePort()




返回Arduino库菜单

返回首页

更多建议和问题欢迎反馈至 YFRobot论坛