WiFi.subnetMask()
描述
取得 WiFi Shield 的子網路遮罩(subnet mask)。
語法
WiFi.subnet();
參數
無參數
回傳
IPAddress: WiFi Shield 的子網路遮罩
範例
#include <WiFi.h>
int status = WL_IDLE_STATUS; // 無線網路的狀態
// 無線網路的 SSID
char ssid[] = "yourNetwork";
// WPA 的密碼
char pass[] = "secretPassword";
IPAddress ip;
IPAddress subnet;
IPAddress gateway;
void setup()
{
WiFi.begin(ssid, pass);
if ( status != WL_CONNECTED) {
Serial.println("Couldn't get a wifi connection");
while(true);
}
// 如果成功連上無線網路,印出相關資訊
else {
// 印出 WiFi Shield 的子網路遮罩
subnet = WiFi.subnetMask();
Serial.print("NETMASK: ");
Serial.println();
}
}
void loop () {
}
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.
