I try to connect ethernet with static ip first, and if it does not connect, I want to connect with dynamic ip.

dallim30
Posts: 20
Joined: Thu Apr 29, 2021 1:35 am

I try to connect ethernet with static ip first, and if it does not connect, I want to connect with dynamic ip.

Postby dallim30 » Mon Jul 04, 2022 2:55 pm

Hello

I was working on project using esp32 wrover-e with PlatformIO v4.4.1 and Arduino framework.
I try to connect ethernet with static ip first, and if it does not connect, I want to connect with dynamic ip.
How can I get Ethernet to work like the above scenario?
I think I need ETH.end(). How should I implement the ETH.end() function?

Any suggestion and help will be highly appreciated.

lbernstone
Posts: 637
Joined: Mon Jul 22, 2019 3:20 pm

Re: I try to connect ethernet with static ip first, and if it does not connect, I want to connect with dynamic ip.

Postby lbernstone » Tue Jul 05, 2022 3:44 pm

I think you can just do your check for connectivity (ping the destination) and if there is no connection, call ETH::config() again with a 0 for your local_ip.
https://github.com/espressif/arduino-es ... H.cpp#L410

Who is online

Users browsing this forum: No registered users and 60 guests