11#include <ArduinoIoTCloud.h>
2- /*
3- The following include line is used for WiFi enabled boards (MKR1000, MKR WiFi 1010)
4- */
5- #include <WiFiConnectionManager.h>
6- /*
7- If you prefer using a MKR GSM 1400 comment the line above and uncommet the following.
8- */
9- //#include <GSMConnectionManager.h>
2+ #include <ConnectionManager.h>
3+
4+ #if defined(BOARD_HAS_WIFI )
5+ #include <WiFiConnectionManager.h>
6+ #elif defined(BOARD_HAS_GSM )
7+ #include <GSMConnectionManager.h>
8+ #else
9+ #error "Arduino IoT Cloud currently only supports MKR1000, MKR WiFi 1010 and MKR GSM 1400"
10+ #endif
11+
1012
1113// Your THING_ID
1214#define THING_ID "ARDUINO_IOT_CLOUD_THING_ID"
@@ -22,11 +24,10 @@ void initProperties() {
2224 ArduinoCloud .addProperty (potentiometer , READ , ON_CHANGE );
2325}
2426
25- /*
26- The following include line is used for WiFi enabled boards (MKR1000, MKR WiFi 1010)
27- */
28- ConnectionManager * ArduinoIoTPreferredConnection = new WiFiConnectionManager (SECRET_SSID , SECRET_PASS );
29- /*
30- If you prefer using a MKR GSM 1400 comment the line above and uncommet the following.
31- */
32- //ConnectionManager *ArduinoIoTPreferredConnection = new GSMConnectionManager(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS);
27+ #if defined(BOARD_HAS_WIFI )
28+ ConnectionManager * ArduinoIoTPreferredConnection = new WiFiConnectionManager (SECRET_SSID , SECRET_PASS );
29+ #elif defined(BOARD_HAS_GSM )
30+ ConnectionManager * ArduinoIoTPreferredConnection = new GSMConnectionManager (SECRET_PIN , SECRET_APN , SECRET_LOGIN , SECRET_PASS );
31+ #endif
32+
33+
0 commit comments