Reference   Language | Libraries | Comparison | Changes

Ethernet

Ethernet.init()

Description

Used to configure the CS (chip select) pin for the Ethernet controller chip. The Ethernet library has a default CS pin, which is usually correct, but with some non-standard Ethernet hardware you might need to use a different CS pin.

Syntax

Ethernet.init(sspin)

Parameters

sspin: the pin number to use for CS (byte)

Returns

Nothing

Example

#include <SPI.h>
#include <Ethernet.h>

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

void setup() {
  Ethernet.init(53);  // use pin 53 for Ethernet CS
  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.