I want to find...

検索

Shares

Table of Content

Ethernet.begin()

[Ethernet]

説明

Initializes the Ethernet library and network settings.

This library supports also DHCP. Using Ethernet.begin(mac) または Ethernet.begin() with the proper network setup, the Ethernet shield will automatically obtain an IP address.

構文

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

媒介変数

  • mac: an array of 6 bytes that contains an MAC (Media access control) address. Since every 86Duino has a fixed MAC address that cannot be changed, this parameter is unused, and is reserved here just for the purpose of compatibility to Arduino’s Ethernet library.
  • ip: the device IP address that you want to set for 86Duino (array of 4 bytes)
  • dns: the IP address of the DNS server (array of 4 bytes). optional: defaults to the device IP address with the last octet set to 1
  • 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

戻り値

The DHCP version of this function, Ethernet.begin(mac) または Ethernet.begin(), returns an int: 1 on a successful DHCP connection, 0 on failure. The other versions don’t return anything.

#include <Ethernet.h>
 
byte mac[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };  
//the IP address:
byte ip[] = { 10, 0, 0, 177 };    
 
void setup()
{
  Ethernet.begin(mac, ip);
}
 
void loop () {}

Libraries Reference Home

86Duino のリファレンスのテキストは Arduino レファレンス を編集したもので、 Creative Commons Attribution-ShareAlike 3.0 License下でライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。

上部へスクロール