-
Notifications
You must be signed in to change notification settings - Fork 82
Ethernet: examples and readme update #342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,18 +6,18 @@ | |
* When you flip the switch in the Cloud dashboard the onboard LED lights gets turned ON or OFF. | ||
|
||
IMPORTANT: | ||
This sketch works with WiFi, GSM, NB and Lora enabled boards supported by Arduino IoT Cloud. | ||
This sketch works with WiFi, GSM, NB, Ethernet and Lora enabled boards supported by Arduino IoT Cloud. | ||
On a LoRa board, if it is configured as a class A device (default and preferred option), values from Cloud dashboard are received | ||
only after a value is sent to Cloud. | ||
|
||
This sketch is compatible with: | ||
The full list of compatible boards can be found here: | ||
- https://github.com/arduino-libraries/ArduinoIoTCloud#what | ||
*/ | ||
|
||
#include "arduino_secrets.h" | ||
#include "thingProperties.h" | ||
|
||
#if defined(ESP32) | ||
#if !defined(LED_BUILTIN) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's much better 🤣 I'm afraid I was the author of the original implementation =) |
||
static int const LED_BUILTIN = 2; | ||
#endif | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
#elif defined(BOARD_HAS_GSM) | ||
#elif defined(BOARD_HAS_LORA) | ||
#elif defined(BOARD_HAS_NB) | ||
#elif defined(BOARD_HAS_ETHERNET) | ||
#else | ||
#error "Please check Arduino IoT Cloud supported boards list: https://github.com/arduino-libraries/ArduinoIoTCloud/#what" | ||
#endif | ||
|
@@ -19,7 +20,7 @@ void initProperties() { | |
ArduinoCloud.setBoardId(BOARD_ID); | ||
ArduinoCloud.setSecretDeviceKey(SECRET_DEVICE_KEY); | ||
#endif | ||
#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) | ||
ArduinoCloud.addProperty(led, Permission::Write).onUpdate(onLedChange); | ||
#elif defined(BOARD_HAS_LORA) | ||
ArduinoCloud.addProperty(led, 1, READWRITE, ON_CHANGE, onLedChange); | ||
|
@@ -34,4 +35,9 @@ void initProperties() { | |
LoRaConnectionHandler ArduinoIoTPreferredConnection(SECRET_APP_EUI, SECRET_APP_KEY, _lora_band::EU868, NULL, _lora_class::CLASS_A); | ||
#elif defined(BOARD_HAS_NB) | ||
NBConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS); | ||
#elif defined(BOARD_HAS_ETHERNET) | ||
/* DHCP mode */ | ||
//EthernetConnectionHandler ArduinoIoTPreferredConnection; | ||
/* Manual mode. It will fallback in DHCP mode if SECRET_OPTIONAL_IP is invalid or equal to "0.0.0.0" */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, the parameter is optional when using DHCP. But maybe a better naming would be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for your clarification. I thought so. In this case there's not much you do I suppose 🤷. |
||
EthernetConnectionHandler ArduinoIoTPreferredConnection(SECRET_OPTIONAL_IP, SECRET_OPTIONAL_DNS, SECRET_OPTIONAL_GATEWAY, SECRET_OPTIONAL_NETMASK); | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are those secrets called
_OPTIONAL_
?