Arduino - EthernetBegin

Arduino

Buy | Download | Getting Started | Learning | Reference | Hardware | FAQ

Blog » | Forum » | Playground »

Reference Language (extended) | Libraries | Comparison | Board

Ethernet

## Ethernet.begin()

#### Description

Initializes the ethernet library and network settings.

#### Syntax

Ethernet.begin(mac, ip);
Ethernet.begin(mac, ip, gateway);
Ethernet.begin(mac, ip, gateway, subnet);

#### Parameters

mac: the MAC address for the device (array of 6 bytes)

ip: the IP address of the device (array of 4 bytes)

gateway: the IP address of the network gateway (array of 4 bytes). optional: defaults to the device IP address with the last octet set to 1

subnet: the subnet mask of the network (array of 4 bytes). optional: defaults to 255.255.255.0

#### Returns

None

#### Example

    #include <Ethernet.h>

    byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
    byte ip[] = { 10, 0, 0, 177 };

    void setup()
    {
      Ethernet.begin(mac, ip);
    }

    void loop {}

Reference Home

Corrections, suggestions, and new documentation should be posted to the Forum.

The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.

Edit Page | Page History | Printable View | All Recent Site Changes