Reference.WiFiSubnetMask History

Show minor edits - Show changes to markup

November 22, 2011, at 05:53 PM by Scott Fitzgerald -
Changed lines 3-4 from:

WiFi.subnet()

to:

WiFi.subnetMask()

November 22, 2011, at 05:52 PM by Scott Fitzgerald -
Changed lines 25-26 from:
to:

int status = WL_IDLE_STATUS; // the Wifi radio's status

Changed lines 38-39 from:
 WiFi.begin(ssid, pass);
to:
  WiFi.begin(ssid, pass);
Changed lines 46-51 from:
  // print your subnet mask:
  subnet = WiFi.subnetMask();
  Serial.print("NETMASK: ");
  Serial.println();
to:
    // print your subnet mask:
    subnet = WiFi.subnetMask();
    Serial.print("NETMASK: ");
    Serial.println();
Changed lines 55-57 from:

void loop () {}

to:

void loop () { }

November 22, 2011, at 05:52 PM by Scott Fitzgerald -
Changed lines 19-20 from:

An array containing the subnet mask of the shield

to:

the subnet mask of the shield

Changed lines 45-54 from:
  ip = WiFi.localIP();
  Serial.print("IP: ");
  Serial.print(ip[0]);
  Serial.print(".");
  Serial.print(ip[1]);
  Serial.print(".");
  Serial.print(ip[2]);
  Serial.print(".");
  Serial.println(ip[3]);
to:
Changed lines 49-67 from:
  Serial.print(subnet[0]);
  Serial.print(".");
  Serial.print(subnet[1]);
  Serial.print(".");
  Serial.print(subnet[2]);
  Serial.print(".");
  Serial.println(subnet[3]);

  // print your gateway address:
  gateway = WiFi.gatewayIP();
  Serial.print("GATEWAY: ");
  Serial.print(gateway[0]);
  Serial.print(".");
  Serial.print(gateway[1]);
  Serial.print(".");
  Serial.print(gateway[2]);
  Serial.print(".");
  Serial.println(gateway[3]);
to:
  Serial.println();
November 22, 2011, at 09:48 AM by Scott Fitzgerald -
Changed line 23 from:

[@

to:
Changed line 81 from:

@]

to:
November 22, 2011, at 03:54 AM by Scott Fitzgerald -
Added lines 1-81:

WiFi

WiFi.subnet()

Description

Gets the WiFi shield's subnet mask

Syntax

WiFi.subnet();

Parameters

none

Returns

An array containing the subnet mask of the shield

Example

#include <WiFi.h>

//SSID of your network 
char ssid[] = "yourNetwork";
//password of your WPA Network 
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);
  } 
  // if you are connected, print out info about the connection:
  else {
  ip = WiFi.localIP();
  Serial.print("IP: ");
  Serial.print(ip[0]);
  Serial.print(".");
  Serial.print(ip[1]);
  Serial.print(".");
  Serial.print(ip[2]);
  Serial.print(".");
  Serial.println(ip[3]);

  // print your subnet mask:
  subnet = WiFi.subnetMask();
  Serial.print("NETMASK: ");
  Serial.print(subnet[0]);
  Serial.print(".");
  Serial.print(subnet[1]);
  Serial.print(".");
  Serial.print(subnet[2]);
  Serial.print(".");
  Serial.println(subnet[3]);

  // print your gateway address:
  gateway = WiFi.gatewayIP();
  Serial.print("GATEWAY: ");
  Serial.print(gateway[0]);
  Serial.print(".");
  Serial.print(gateway[1]);
  Serial.print(".");
  Serial.print(gateway[2]);
  Serial.print(".");
  Serial.println(gateway[3]);

  }
}

void loop () {}

Share