Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

static IP (not for the config portal) #22

Answered by khoih-prog
stanelie asked this question in Q&A
Discussion options

You must be logged in to vote

To use static IP, you have to use the following function in your code

void setSTAStaticIPConfig(const IPAddress& ip, const IPAddress& gw,
const IPAddress& sn = IPAddress(255, 255, 255, 0),
const IPAddress& dns_address_1 = IPAddress(0, 0, 0, 0),
const IPAddress& dns_address_2 = IPAddress(0, 0, 0, 0))
{
static_IP = ip;
static_GW = gw;
static_SN = sn;
// Default to local GW
if (dns_address_1 == IPAddress(0, 0, 0, 0))
static_DNS1 = gw;
else
static_DNS1 = dns_address_1;
// Default to Google DNS (8, 8, 8, 8)
if (dns_address_2 ==

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by stanelie
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants