Ethernet.gatewayIP()

名称

Ethernet.gatewayIP()

説明

デバイスに設定された、ゲートウェイのIPアドレスを取得する。

書式

IPAddress EthernetClass::gatewayIP();

引数

なし。

戻り値

デバイスに設定された、ゲートウェイのIPアドレス。

使用例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include <SPI.h>
#include <Ethernet.h>

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

void setup() {
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  Ethernet.begin(mac, ip);

  Serial.print("The gateway IP address is: ");
  Serial.println(Ethernet.gatewayIP());
}

void loop () {}

オリジナルのページ

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

最終更新日

January 7, 2024

inserted by FC2 system