1
1
/* SECRET_ fields are in arduino_secrets.h included above
2
- * if using a WiFi board (Arduino MKR1000, MKR WiFi 1010, Nano 33 IoT, UNO
2
+ *
3
+ * If using a Host + Notecard connected over I2C you'll need a
4
+ * NotecardConnectionHandler object as follows
5
+ *
6
+ * NotecardConnectionHandler conMan(NOTECARD_PRODUCT_UID);
7
+ *
8
+ * If using a Host + Notecard connected over Serial you'll need a
9
+ * NotecardConnectionHandler object as follows
10
+ *
11
+ * NotecardConnectionHandler conMan(NOTECARD_PRODUCT_UID, Serial);
12
+ *
13
+ * If using a WiFi board (Arduino MKR1000, MKR WiFi 1010, Nano 33 IoT, UNO
3
14
* WiFi Rev 2 or ESP8266/32), create a WiFiConnectionHandler object by adding
4
- * Network Name (SECRET_SSID ) and password (SECRET_PASS ) in the arduino_secrets.h
5
- * file (or Secrets tab in Create Web Editor).
15
+ * Network Name (SECRET_WIFI_SSID ) and password (SECRET_WIFI_PASS ) in the
16
+ * arduino_secrets.h file (or Secrets tab in Create Web Editor).
6
17
*
7
- * WiFiConnectionHandler conMan(SECRET_SSID, SECRET_PASS );
18
+ * WiFiConnectionHandler conMan(SECRET_WIFI_SSID, SECRET_WIFI_PASS );
8
19
*
9
20
* If using a MKR GSM 1400 or other GSM boards supporting the same API you'll
10
21
* need a GSMConnectionHandler object as follows
31
42
32
43
#include < Arduino_ConnectionHandler.h>
33
44
34
- #if defined(BOARD_HAS_ETHERNET)
45
+ #if !(defined(USE_NOTECARD) || defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_LORA) || \
46
+ defined (BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT))
47
+ #error " Please check Arduino Connection Handler supported boards list: https://github.com/arduino-libraries/Arduino_ConnectionHandler/blob/master/README.md"
48
+ #endif
49
+
50
+ #if defined(USE_NOTECARD)
51
+ /* The Notecard can provide connectivity to almost any board via ESLOV (I2C)
52
+ * or UART. An empty string (or the default value provided below) will not
53
+ * override the Notecard's existing configuration.
54
+ * Learn more at: https://dev.blues.io */
55
+ #define NOTECARD_PRODUCT_UID " com.domain.you:product"
56
+ #endif
57
+
58
+ #if defined(USE_NOTECARD)
59
+ NotecardConnectionHandler conMan (NOTECARD_PRODUCT_UID);
60
+ #elif defined(BOARD_HAS_ETHERNET)
35
61
EthernetConnectionHandler conMan (SECRET_IP, SECRET_DNS, SECRET_GATEWAY, SECRET_NETMASK);
36
62
#elif defined(BOARD_HAS_WIFI)
37
- WiFiConnectionHandler conMan (SECRET_SSID, SECRET_PASS );
63
+ WiFiConnectionHandler conMan (SECRET_WIFI_SSID, SECRET_WIFI_PASS );
38
64
#elif defined(BOARD_HAS_GSM)
39
65
GSMConnectionHandler conMan (SECRET_PIN, SECRET_APN, SECRET_GSM_USER, SECRET_GSM_PASS);
40
66
#elif defined(BOARD_HAS_NB)
@@ -48,9 +74,9 @@ CellularConnectionHandler conMan(SECRET_PIN, SECRET_APN, SECRET_GSM_USER, SECRET
48
74
#endif
49
75
50
76
void setup () {
77
+ /* Initialize serial and wait up to 5 seconds for port to open */
51
78
Serial.begin (9600 );
52
- /* Give a few seconds for the Serial connection to be available */
53
- delay (4000 );
79
+ for (unsigned long const serialBeginTime = millis (); !Serial && (millis () - serialBeginTime <= 5000 ); ) { }
54
80
#ifndef __AVR__
55
81
setDebugMessageLevel (DBG_INFO);
56
82
#endif
0 commit comments