Ethernet.setLocalIP()

名称

Ethernet.setLocalIP()

説明

デバイスのIPアドレスを設定する。DHCPのときは利用しない。

書式

void EthernetClass::setLocalIP(const IPAddress local_ip);

引数

local_ip利用するIPアドレス。

戻り値

なし。

使用例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include <SPI.h>
#include <Ethernet.h>

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

void setup() {
  Ethernet.begin(mac, ip);
  IPAddress newIp(10, 0, 0, 178);
  Ethernet.setLocalIP(newIp);  // change the IP address
}

void loop () {}

オリジナルのページ

https://www.arduino.cc/reference/en/libraries/ethernet/ethernet.setlocalip/

最終更新日

January 7, 2024

inserted by FC2 system