by slime » Fri Aug 19, 2016 5:37 pm
Hi,
I've just re-iped my home network as I was almost running out of 254 addresses!! Well - maybe not quite but it was a mess. So I now use a supernet and have 4 ranges - 192.168.16.x, 17.x, 18.x and 19.x for others.
Anyway, my door opener was 192.168.0.8.
Searching for subnet mask on the forum I came to this post - useful - thanks - I may need to add mask and gateway in. But in your link above, it says that v1.0 of the libarary it now supports DHCP.
The garage door opener was the only device on my network with a hardcoded IP. All my other devices are DHCP, but reserved addresses (static) in my router.
Anyone tried DHCP? It says we need to call ethernet.maintain to ensure the DHCP lease hasn't run out.
With version 1.0, the library supports DHCP. Using Ethernet.begin(mac) with the proper network setup, the Ethernet shield will automatically obtain an IP address. This increases the sketch size significantly. To make sure the DHCP lease is properly renewed when needed, be sure to call Ethernet.maintain() regularly.
Returns
The DHCP version of this function, Ethernet.begin(mac), returns an int: 1 on a successful DHCP connection, 0 on failure. The other versions don't return anything.
Any help or advice?
I'm thinking we can do something like
if Ethernet.begin(mac) == 0 {
Ethernet.begin(mac, fallbackip, fallbackdns, fallbackgateway, fallbacksubnet)
}
:
code
:
:
then near the end
we need to see if we are DHCP somehow and if so call Ethernet.maintain()
Thanks,
Si.