This is the documentation for the latest development branch of MicroPython and may refer to features that are not available in released versions.

If you are looking for the documentation for a specific release, use the drop-down menu on the left and select the desired version.

ethernet

ethernet.active(self, state: bool) True

If called with no args, return the current state of the ethernet driver. Else start or stop the ethernet driver

Parameters:

state (bool) – activate the ethernet driver if True else stop it

ethernet.status(self) int

Return the current status of the driver can be:

  • INITIALIZED: 0, intial status

  • STARTED: 1, the driver is started and the module was found

  • STOPPED: 2, the driver is stopped

  • CONNECTED: 3, ethernet connection established

  • DISCONNECTED: 4, ethernet connection lost

  • GOT_IP: 5, ethernet connection established and IP address set

ethernet.isconnected(self) bool

Return True if IP is set

ethernet.ifconfig(self, ip_config: list / tuple / str) int

If called with no arg, return the current IP address. Else set the interface configuration

Parameters:

ip_config (list/tuple/str) – Can be “dhcp” to configure the interface using DHCP or a list/tuple with the following args:

  • ip address: str

  • netmask: str

  • gateway: str

  • DNS: str

ethernet.get_lan(self) network.LAN

Return the intern LAN object