Arduino Function: WiFi.config

Description

This function allows you to configure a static IP address, change the DNS, gateway, and subnet addresses on the WiFi shield manually. (WiFi.begin automatically configures to use DHCP)

Syntax

WiFi.config(ip); 
WiFi.config(ip, dns); 
WiFi.config(ip, dns, gateway); 
WiFi.config(ip, dns, gateway, subnet);

Parameters

  • ip: the IP address of the device (array of 4 bytes)
  • dns: the address for a DNS server.
  • gateway: the IP address of the network gateway (array of 4 bytes). optional: defaults to the device IP address with the last octet set to 1
  • subnet: the subnet mask of the network (array of 4 bytes). optional: defaults to 255.255.255.0


Based on the reference originally written by Arduino Community,  wiring.org.co and  arduino.cc