Hardware Reference
In-Depth Information
Table 10-1 ( continued )
CONSTANT
MEANING
WL_DISCONNECTED
The WiFi shield has successfully disconnected from a network.
WL_NO_SHIELD
The Arduino cannot fi nd a WiFi shield connected to the board.
Unlike Ethernet shields, WiFi shields have a i xed MAC address. To know
the MAC address of the WiFi shield, use macAddress(). This function does
not return any data but requires a parameter: a 6-byte array in which the MAC
address will be placed.
byte mac[6];
WiFi.macAddress(mac); //Retrieve the MAC address, place it in mac
To retrieve the MAC address for the access point you are connected to, use
BSSID() :
WiFi.BSSID(bssid);
Just like the macAddress() function, this function does not return any data
but requires a data container as a parameter: a 6-byte array in which the MAC
address will be placed.
To retrieve the RSSI, the signal quality indicator, use the RSSI() function:
long result = WiFi.RSSI();
RSSI, short for Received Signal Strength Indication, is a measurement of
power in received radio signals. It is an indicator that generally goes from −100
to 0; the closer to 0, the stronger the reception. It cannot be used to estimate the
range of a wireless device since interference can come not only from range, but
also from electronic equipment or walls.
Scanning Networks
Due to the mobile nature of wireless, it can be helpful to scan the wireless
networks around you to know which to connect to. An Arduino in a car might
automatically connect to a home network when it's in range to send diagnostic
information on your car but might also be coni gured to connect to another
network, for example, a friend's house. In this case, the Arduino needs to peri-
odically scan the available wireless networks until it i nds one it recognizes.
Wireless scanning on computers is frequent; open your wireless coni guration
panel to see a list of available networks.
To initiate a scan, use scanNetworks() :
result = WiFi.scanNetworks();
 
Search WWH ::




Custom Search