我有一个带有以太网屏蔽的Arduino . 当我在本地网络上调用IP地址时,它可以正常工作 . 但现在我必须将我的项目部署到服务器,因此我无法调用本地IP地址 .

我必须拨打公共IP地址,但这不起作用,我不知道如何使其工作 .

这就是我现在的代码:

#include <SPI.h>
#include <Ethernet2.h>

byte mac[] = { 0x90, 0xA2, 0xDA, 0x11, 0x44, 0xA6 }; // MACADDRESS
IPAddress ip(192, 168, 0, 190); // IP
EthernetServer server(80); // PORT

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

    // start the Ethernet connection and the server:
    Ethernet.begin(mac, ip);
    server.begin();
    Serial.print("server is at ");
    Serial.println(Ethernet.localIP());
}