The ETH class enables the use of an ethernet connection via the PyEthernet board plugged into a Pygate.
NOTE : Ethernet support is only available in the Pygate firmware build.
NOTE2 : The PyEthernet board is connected via SPI bus 3 and GPIO’s 17-19 and 21-23. So this bus and pins cannot be used concurrently with ethernet. This also means that on a LoPy4 with Pygate firmware, the LoRa module of the LoPy4 is disabled, since it is also connected via SPI 3. Of course you can still use the LoRa gateway functionality since this uses the LoRa modules on the the Pygate board itself.
Create and configure an ETH object. See init for params of configuration.
from network import ETH eth = ETH()
This function starts the Ethernet interface and enables the ethernet adapter.
hostname: set the interface hostname
hostname
Get or set the interface configuration.
Optionally specify the configuration parameter:
config='dhcp'
config=(ip, nm, gw, dns)
For example: eth.ifconfig(config=('192.168.0.4', '255.255.255.0', '192.168.0.1', '8.8.8.8')).
eth.ifconfig(config=('192.168.0.4', '255.255.255.0', '192.168.0.1', '8.8.8.8'))
Set the interface host name.
Get the ethernet interface mac address.
Shut down the ethernet interface.
Return True if the ethernet link is up and IP is acquired, False otherwise.
True
False