WiFi library
With the Arduino WiFi Shield, this library allows an 86Duino board to connect to the internet via Wireless LAN. 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.
86Duino communicates with the WiFi shield using the SPI bus. But to match the design of the Arduino WiFi Shield, digital pin 10 is used as SS; the hardware SS pin on the SPI header is not used. Digital pin 7 is used as a handshake pin between the Wifi shield and the 86Duino, and should not be used.
The WiFi library is very similar to the Ethernet library, and many of the function calls are the same.
Note on the Firmware for the WiFi Shield
Arduino has changed the firmware for the Arduino WiFi Shield from Arduino IDE 1.0.5, and you can follow Arduino’s instructions to install the new firmware. We note that the new firmware is incompatible to the old firmware, and cannot be used with WiFi libraries in older Arduino IDE such as 1.0.4 and 1.5.2.
Since the WiFi library in 86Duino IDE is ported from Arduino 1.5.2, you can use a WiFi shield with only the old firmware. If needing to use a WiFi shield with the new firmware, you should employ the WiFi2 library instead. You can download the WiFi2 library here and then install it into the 86Duino IDE.
The usage of the WiFi2 library is basically the same as that of the WiFi library; but with new firmware for the WiFi shield, an additional UDP class is enabled. The usage of the UDP class isn’t mentioned here, and you can refer to Arduino’s WiFi library reference for that.
WiFi class
The WiFi class initializes the WiFi library and network settings.
- begin()
- disconnect()
- config()
- setDNS()
- SSID()
- BSSID()
- RSSI()
- encryptionType()
- scanNetworks()
- getSocket()
- macAddress()
IPAddress class
The IPAddress class provides information about the network configuration.
- localIP()
- subnetMask()
- gatewayIP()
Server class
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 class
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()
Examples
The following are examples of the WiFi library from the Arduino Tutorial that can work on the 86Duino boards:
- 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
- WiFiXivelyClient: connect to xively.com, a free datalogging site
- WiFiXivelyClientString: send strings to xively.com
- WiFiWebClient: Connect to a remote webserver
- WiFiWebClientRepeating: Make repeated HTTP calls to a webserver
- WiFiWebServer: Serve a webpage from the WiFi shield
The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.