diff --git a/examples/ConnectionHandlerDemo/ConnectionHandlerDemo.ino b/examples/ConnectionHandlerDemo/ConnectionHandlerDemo.ino index 2246fc10..3cef607d 100644 --- a/examples/ConnectionHandlerDemo/ConnectionHandlerDemo.ino +++ b/examples/ConnectionHandlerDemo/ConnectionHandlerDemo.ino @@ -16,6 +16,9 @@ * NBConnectionHandler conMan(SECRET_PIN); */ + +//#define ARDUINO_ETHERNET_SHIELD /* Uncomment this line if you want to use a ethernet shield */ + #include "arduino_secrets.h" #include @@ -28,11 +31,18 @@ GSMConnectionHandler conMan(SECRET_APN, SECRET_PIN, SECRET_GSM_USER, SECRET_GSM_ NBConnectionHandler conMan(SECRET_PIN); #elif defined(BOARD_HAS_LORA) LoRaConnectionHandler conMan(SECRET_APP_EUI, SECRET_APP_KEY); +#elif defined(BOARD_HAS_ETHERNET) +byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; +EthernetConnectionHandler conMan(mac); #endif void setup() { Serial.begin(9600); /* Give a few seconds for the Serial connection to be available */ + #if defined(BOARD_HAS_ETHERNET) + SPI.begin(); + Ethernet.init(10); // CS pin on most Arduino shields + #endif delay(4000); setDebugMessageLevel(DBG_INFO); diff --git a/src/Arduino_ConnectionHandler.h b/src/Arduino_ConnectionHandler.h index 348cc94c..59671a00 100644 --- a/src/Arduino_ConnectionHandler.h +++ b/src/Arduino_ConnectionHandler.h @@ -176,7 +176,7 @@ class ConnectionHandler { NetworkConnectionState check(); - #if defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) + #if defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) virtual unsigned long getTime() = 0; virtual Client &getClient() = 0; virtual UDP &getUDP() = 0;