* updated from upstream

* forced connection attempt is now hardcoded in Sodaq_nbIOT::connectSocket()
* udp send recieve now works, may contain bugs on fast multiple incoming messages,
  have to check if this can be an issue or not
This commit is contained in:
Dávid Danyi
2018-02-15 18:48:07 +01:00
parent cfae7d6ba8
commit e0f54a37cd
10 changed files with 1077 additions and 198 deletions

View File

@@ -0,0 +1,147 @@
#include <Arduino.h>
#include <Sodaq_nbIOT.h>
#include <Sodaq_UBlox_GPS.h>
#if defined(ARDUINO_AVR_LEONARDO)
#define DEBUG_STREAM Serial
#define MODEM_STREAM Serial1
#elif defined(ARDUINO_SODAQ_EXPLORER)
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial
#elif defined(ARDUINO_SAM_ZERO)
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial1
#else
#error "Please select one of the listed boards."
#endif
#define ARRAY_DIM(arr) (sizeof(arr) / sizeof(arr[0]))
Sodaq_nbIOT nbiot;
// List of interval values to be used in loop()
// to measure how long it takes to get a fix.
uint32_t intervals[] = {
// Do a few tests with 1 minute delay
1UL * 60 * 1000,
1UL * 60 * 1000,
1UL * 60 * 1000,
// Try a few longer delays
2UL * 60 * 1000,
2UL * 60 * 1000,
5UL * 60 * 1000,
5UL * 60 * 1000,
// Slowly increase the delays
15UL * 60 * 1000,
30UL * 60 * 1000,
1UL * 60 * 60 * 1000,
3UL * 60 * 60 * 1000,
4UL * 60 * 60 * 1000,
8UL * 60 * 60 * 1000,
};
size_t interval_ix = 0;
void find_fix(uint32_t delay_until);
void do_flash_led(int pin);
void setup()
{
while ((!DEBUG_STREAM) && (millis() < 10000)) {
// Wait for serial monitor for 10 seconds
}
DEBUG_STREAM.begin(57600);
MODEM_STREAM.begin(nbiot.getDefaultBaudrate());
nbiot.init(MODEM_STREAM, 7);
nbiot.setDiag(DEBUG_STREAM);
if (nbiot.connect("oceanconnect.t-mobile.nl", "172.16.14.22", "20416")) {
DEBUG_STREAM.println("Connected succesfully!");
}
else {
DEBUG_STREAM.println("Failed to connect!");
return;
}
digitalWrite(13, HIGH);
pinMode(13, OUTPUT);
//digitalWrite(LED_GREEN, HIGH);
//pinMode(LED_GREEN, OUTPUT);
//digitalWrite(LED_BLUE, HIGH);
//pinMode(LED_BLUE, OUTPUT);
do_flash_led(13);
//do_flash_led(LED_GREEN);
//do_flash_led(LED_BLUE);
DEBUG_STREAM.println("SODAQ NB-IoT SAM-M8Q test is starting ...");
sodaq_gps.init(6);
// This is for debugging to see more details, more messages
// Use this in combination with setDiag()
//sodaq_gps.setMinNumOfLines(10);
// Uncomment the next line if you want to see the incoming $GPxxx messages
sodaq_gps.setDiag(DEBUG_STREAM);
// First time finding a fix
find_fix(0);
}
void loop()
{
uint32_t wait_ms = intervals[interval_ix];
if (++interval_ix > ARRAY_DIM(intervals)) {
interval_ix = 0;
}
find_fix(wait_ms);
}
/*!
* Find a GPS fix, but first wait a while
*/
void find_fix(uint32_t delay_until)
{
DEBUG_STREAM.println(String("delay ... ") + delay_until + String("ms"));
delay(delay_until);
uint32_t start = millis();
uint32_t timeout = 900L * 1000;
DEBUG_STREAM.println(String("waiting for fix ..., timeout=") + timeout + String("ms"));
if (sodaq_gps.scan(false, timeout)) {
String message = "";
message += (String(" time to find fix: ") + (millis() - start) + String("ms"));
message += (String(" datetime = ") + sodaq_gps.getDateTimeString());
message += (String(" lat = ") + String(sodaq_gps.getLat(), 7));
message += (String(" lon = ") + String(sodaq_gps.getLon(), 7));
message += (String(" num sats = ") + String(sodaq_gps.getNumberOfSatellites()));
if (!nbiot.sendMessage(message)) {
DEBUG_STREAM.println("Could not queue message!");
}
}
else {
DEBUG_STREAM.println("No Fix");
if (!nbiot.sendMessage("No Fix")) {
DEBUG_STREAM.println("Could not queue message!");
}
}
}
void do_flash_led(int pin)
{
for (size_t i = 0; i < 2; ++i) {
delay(100);
digitalWrite(pin, LOW);
delay(100);
digitalWrite(pin, HIGH);
}
}

View File

@@ -0,0 +1,81 @@
#include <Arduino.h>
#include <Wire.h>
// #include <SoftwareSerial.h> // Uno
#include <Sodaq_nbIOT.h>
#include <Sodaq_HTS221.h>
#if defined(ARDUINO_AVR_LEONARDO)
#define DEBUG_STREAM Serial
#define MODEM_STREAM Serial1
#elif defined(ARDUINO_AVR_UNO)
SoftwareSerial softSerial(10, 11); // RX, TX
// You can connect an uartsbee or other board (e.g. 2nd Uno) to connect the softserial.
#define DEBUG_STREAM softSerial
#define MODEM_STREAM Serial
#elif defined(ARDUINO_SODAQ_EXPLORER)
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial
#elif defined(ARDUINO_SAM_ZERO)
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial1
#else
#error "Please select one of the listed boards."
#endif
Sodaq_nbIOT nbiot;
Sodaq_HTS221 humiditySensor;
void setup()
{
while ((!DEBUG_STREAM) && (millis() < 10000)) {
// Wait for serial monitor for 10 seconds
}
Wire.begin();
DEBUG_STREAM.begin(9600);
MODEM_STREAM.begin(nbiot.getDefaultBaudrate());
DEBUG_STREAM.println("\r\nSODAQ Humidity and Temperature Example\r\n");
nbiot.init(MODEM_STREAM, 7);
nbiot.setDiag(DEBUG_STREAM);
delay(2000);
if (nbiot.connect("oceanconnect.t-mobile.nl", "172.16.14.22", "20416")) {
DEBUG_STREAM.println("Connected succesfully!");
}
else {
DEBUG_STREAM.println("Failed to connect!");
}
if (humiditySensor.init()) {
DEBUG_STREAM.println("Temperature + humidity sensor initialized.");
humiditySensor.enableSensor();
}
else {
DEBUG_STREAM.println("Temperature + humidity initialization failed!");
}
}
void loop()
{
// Create the message
String message = String(humiditySensor.readTemperature()) + "C" +
", " + String(humiditySensor.readHumidity()) + "%";
// Print the message we want to send
DEBUG_STREAM.println(message);
// Send the message
nbiot.sendMessage(message);
// Wait some time between messages
delay(10000); // 1000 = 1 sec
}

View File

@@ -0,0 +1,136 @@
#include <Arduino.h>
#include <Wire.h>
#include <Sodaq_wdt.h>
#include <Sodaq_nbIOT.h>
#include <Sodaq_HTS221.h>
#if defined(ARDUINO_AVR_UNO)
#include <SoftwareSerial.h> // Uno
#endif
#if defined(ARDUINO_AVR_LEONARDO)
#define DEBUG_STREAM Serial
#define MODEM_STREAM Serial1
#elif defined(ARDUINO_AVR_UNO)
SoftwareSerial softSerial(10, 11); // RX, TX
// You can connect an uartsbee or other board (e.g. 2nd Uno) to connect the softserial.
#define DEBUG_STREAM softSerial
#define MODEM_STREAM Serial
#elif defined(ARDUINO_SODAQ_EXPLORER)
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial
#elif defined(ARDUINO_SAM_ZERO)
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial1
#else
#error "Please select a Sodaq ExpLoRer, Arduino Leonardo or add your board."
#endif
Sodaq_nbIOT nbiot;
Sodaq_HTS221 humiditySensor;
void setup()
{
while ((!DEBUG_STREAM) && (millis() < 10000)) {
// Wait for serial monitor for 10 seconds
}
Wire.begin();
DEBUG_STREAM.begin(9600);
MODEM_STREAM.begin(nbiot.getDefaultBaudrate());
DEBUG_STREAM.println("\r\nSODAQ Temperature and Humidity AllThingsTalk Example\r\n");
nbiot.init(MODEM_STREAM, 7);
nbiot.setDiag(DEBUG_STREAM);
delay(2000);
if (nbiot.connect("oceanconnect.t-mobile.nl", "172.16.14.22", "20416")) {
DEBUG_STREAM.println("Connected succesfully!");
}
else {
DEBUG_STREAM.println("Failed to connect!");
return;
}
if (humiditySensor.init()) {
DEBUG_STREAM.println("Temperature + humidity sensor initialized.");
humiditySensor.enableSensor();
}
else {
DEBUG_STREAM.println("Temperature + humidity initialization failed!");
}
}
void loop()
{
// Create the message
byte message[8];
uint16_t cursor = 0;
int16_t temperature;
int16_t humidity;
temperature = humiditySensor.readTemperature() * 100;
DEBUG_STREAM.println(temperature);
message[cursor++] = temperature >> 8;
message[cursor++] = temperature;
humidity = humiditySensor.readHumidity() * 100;
DEBUG_STREAM.println(humidity);
message[cursor++] = humidity >> 8;
message[cursor++] = humidity;
// Print the message we want to send
// DEBUG_STREAM.println(message);
for (int i = 0; i < cursor; i++) {
if (message[i] < 10) {
DEBUG_STREAM.print("0");
}
DEBUG_STREAM.print(message[i], HEX);
DEBUG_STREAM.print(":");
}
DEBUG_STREAM.println();
// Send the message
nbiot.sendMessage(message, cursor);
// Wait some time between messages
delay(10000); // 1000 = 1 sec
}
/*****
* ATT Settings
*
* create a new asset as Number
*
* device decoding:
{
"sense": [
{
"asset": "temperature",
"value" : {
"byte": 0,
"bytelength" : 2,
"type" : "integer",
"calculation" : "val / 100"
}
},
{
"asset": "humidity",
"value" : {
"byte": 2,
"bytelength" : 2,
"type" : "integer",
"calculation" : "val / 100"
}
}
]
}
*/

View File

@@ -0,0 +1,71 @@
#include <Wire.h>
#include <Sodaq_nbIOT.h>
#include <Sodaq_LPS22HB.h>
#if defined(ARDUINO_AVR_LEONARDO)
#define DEBUG_STREAM Serial
#define MODEM_STREAM Serial1
#elif defined(ARDUINO_SODAQ_EXPLORER)
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial
#elif defined(ARDUINO_SAM_ZERO)
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial1
#else
#error "Please select one of the listed boards."
#endif
Sodaq_nbIOT nbiot;
Sodaq_LPS22HB barometricSensor;
void setup()
{
while ((!DEBUG_STREAM) && (millis() < 10000)) {
// Wait for serial monitor for 10 seconds
}
Wire.begin();
DEBUG_STREAM.begin(9600);
MODEM_STREAM.begin(nbiot.getDefaultBaudrate());
DEBUG_STREAM.println("\r\nSODAQ LPS22HB Arduino Example\r\n");
nbiot.init(MODEM_STREAM, 7);
nbiot.setDiag(DEBUG_STREAM);
if (nbiot.connect("oceanconnect.t-mobile.nl", "172.16.14.22", "20416")) {
DEBUG_STREAM.println("Connected succesfully!");
}
else {
DEBUG_STREAM.println("Failed to connect!");
}
if (barometricSensor.init()) {
DEBUG_STREAM.println("Barometric sensor initialization succeeded!");
barometricSensor.enableSensor(Sodaq_LPS22HB::OdrOneShot);
}
else {
DEBUG_STREAM.println("Barometric sensor initialization failed!");
}
DEBUG_STREAM.println("Done with setup!");
}
void loop()
{
// Create the message
String message = String(barometricSensor.readPressureHPA()) + " mbar";
// Print the message we want to send
DEBUG_STREAM.println(message);
// Send the message
nbiot.sendMessage(message);
// Wait some time between messages
delay(10000); // 1000 = 1 sec
}

View File

@@ -0,0 +1,255 @@
#include <Arduino.h>
#include <Wire.h>
#include <Sodaq_nbIOT.h>
#include <Sodaq_HTS221.h>
#include <Sodaq_LPS22HB.h>
#include <Sodaq_UBlox_GPS.h>
#if defined(ARDUINO_AVR_UNO)
#include <SoftwareSerial.h> // Uno
#endif
#if defined(ARDUINO_AVR_LEONARDO)
#define DEBUG_STREAM Serial
#define MODEM_STREAM Serial1
#elif defined(ARDUINO_AVR_UNO)
SoftwareSerial softSerial(10, 11); // RX, TX
// You can connect an uartsbee or other board (e.g. 2nd Uno) to connect the softserial.
#define DEBUG_STREAM softSerial
#define MODEM_STREAM Serial
#elif defined(ARDUINO_SODAQ_EXPLORER)
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial
#elif defined(ARDUINO_SAM_ZERO)
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial1
#else
#error "Please select one of the listed boards."
#endif
Sodaq_nbIOT nbiot;
Sodaq_HTS221 humiditySensor;
Sodaq_LPS22HB barometricSensor;
uint32_t lat = 0;
uint32_t lon = 0;
void setup();
bool connectToNetwork();
void initHumidityTemperature();
void initPressureSensor();
void initGPS();
void loop();
void do_flash_led(int pin);
void setup()
{
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
while ((!DEBUG_STREAM) && (millis() < 10000)) {
// Wait for serial monitor for 10 seconds
}
DEBUG_STREAM.begin(9600);
MODEM_STREAM.begin(nbiot.getDefaultBaudrate());
DEBUG_STREAM.println("\r\nSODAQ NB-IoT Shield AllThingsTalk Example\r\n");
Wire.begin();
nbiot.init(MODEM_STREAM, 7);
nbiot.setDiag(DEBUG_STREAM);
delay(2000);
while (!connectToNetwork());
initHumidityTemperature();
initPressureSensor();
initGPS();
digitalWrite(13, LOW);
}
bool connectToNetwork() {
if (nbiot.connect("oceanconnect.t-mobile.nl", "172.16.14.22", "20416")) {
DEBUG_STREAM.println("Connected succesfully!");
return true;
}
else {
DEBUG_STREAM.println("Failed to connect!");
delay(2000);
return false;
}
}
void initHumidityTemperature() {
if (humiditySensor.init()) {
DEBUG_STREAM.println("Temperature + humidity sensor initialized.");
humiditySensor.enableSensor();
}
else {
DEBUG_STREAM.println("Temperature + humidity initialization failed!");
}
}
void initPressureSensor() {
if (barometricSensor.init()) {
DEBUG_STREAM.println("Barometric sensor initialization succeeded!");
barometricSensor.enableSensor(Sodaq_LPS22HB::OdrOneShot);
}
else {
DEBUG_STREAM.println("Barometric sensor initialization failed!");
}
}
void initGPS() {
sodaq_gps.init(6);
// sodaq_gps.setDiag(DEBUG_STREAM);
}
void loop()
{
do_flash_led(13);
// Create the message
byte message[14];
uint16_t cursor = 0;
int16_t temperature;
int16_t humidity;
int16_t pressure;
temperature = humiditySensor.readTemperature() * 100;
DEBUG_STREAM.println("Temperature x100 : " + (String)temperature);
message[cursor++] = temperature >> 8;
message[cursor++] = temperature;
delay(100);
humidity = humiditySensor.readHumidity() * 100;
DEBUG_STREAM.println("Humidity x100 : " + (String)humidity);
message[cursor++] = humidity >> 8;
message[cursor++] = humidity;
delay(100);
pressure = barometricSensor.readPressureHPA();
DEBUG_STREAM.println("Pressure:" + (String)pressure);
message[cursor++] = pressure >> 8;
message[cursor++] = pressure;
uint32_t start = millis();
uint32_t timeout = 1UL * 10 * 1000; // 10 sec timeout
DEBUG_STREAM.println(String("waiting for fix ..., timeout=") + timeout + String("ms"));
if (sodaq_gps.scan(true, timeout)) {
lat = sodaq_gps.getLat() * 100000;
lon = sodaq_gps.getLon() * 100000;
}
else {
DEBUG_STREAM.println("No Fix");
}
message[cursor++] = lat >> 24;
message[cursor++] = lat >> 16;
message[cursor++] = lat >> 8;
message[cursor++] = lat;
message[cursor++] = lon >> 24;
message[cursor++] = lon >> 16;
message[cursor++] = lon >> 8;
message[cursor++] = lon;
// Print the message we want to send
// DEBUG_STREAM.println(message);
for (int i = 0; i < cursor; i++) {
if (message[i] < 0x10) {
DEBUG_STREAM.print("0");
}
DEBUG_STREAM.print(message[i], HEX);
if (i < (cursor - 1)) {
DEBUG_STREAM.print(":");
}
}
DEBUG_STREAM.println();
// Send the message
nbiot.sendMessage(message, cursor);
// Wait some time between messages
delay(10000); // 1000 = 1 sec
}
void do_flash_led(int pin)
{
for (size_t i = 0; i < 2; ++i) {
delay(100);
digitalWrite(pin, LOW);
delay(100);
digitalWrite(pin, HIGH);
delay(100);
digitalWrite(pin, LOW);
}
}
/*****
* ATT Settings
*
* create a new asset as Number
*
* device decoding:
{
"sense": [
{
"asset": "my_temperature",
"value": {
"byte": 0,
"bytelength": 2,
"type": "integer",
"calculation": "val / 100"
}
},
{
"asset": "my_humidity",
"value": {
"byte": 2,
"bytelength": 2,
"type": "integer",
"calculation": "val / 100"
}
},
{
"asset": "my_pressure",
"value": {
"byte": 4,
"bytelength": 2,
"type": "integer"
}
},
{
"asset": "my_gps",
"value": {
"latitude": {
"byte": 6,
"bytelength": 4,
"type": "integer",
"calculation": "val / 100000"
},
"longitude": {
"byte": 10,
"bytelength": 4,
"type": "integer",
"calculation": "val / 100000"
}
}
}
]
}
*/

View File

@@ -0,0 +1,86 @@
#include <Arduino.h>
#if defined(ARDUINO_AVR_LEONARDO)
/* Arduino Leonardo + SODAQ NB-IoT Shield */
#define DEBUG_STREAM Serial
#define MODEM_STREAM Serial1
#define powerPin 7
#elif defined(ARDUINO_SODAQ_EXPLORER)
/* SODAQ Explorer + SODAQ NB-IoT Shield */
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial
#define powerPin 7
#elif defined(ARDUINO_SAM_ZERO)
/* Arduino Zero / M0 + SODAQ NB-IoT Shield */
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial1
#define powerPin 7
#elif defined(ARDUINO_SODAQ_AUTONOMO)
/* SODAQ AUTONOMO + SODAQ NB-IoT Bee */
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial1
#define powerPin BEE_VCC
#define enablePin BEEDTR
#elif defined(ARDUINO_AVR_SODAQ_MBILI)
/* SODAQ MBILI + SODAQ NB-IoT Bee */
#define DEBUG_STREAM Serial
#define MODEM_STREAM Serial1
#define enablePin BEEDTR
#elif defined(ARDUINO_SODAQ_SARA)
/* SODAQ SARA */
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial1
#define powerPin SARA_ENABLE
#define enablePin SARA_TX_ENABLE
#else
#error "Please use one of the listed boards or add your board."
#endif
unsigned long baud = 9600; //start at 9600 allow the USB port to change the Baudrate
void setup()
{
#ifdef powerPin
// Turn the nb-iot module on
pinMode(powerPin, OUTPUT);
digitalWrite(powerPin, HIGH);
#endif
#ifdef enablePin
// Set state to active
pinMode(enablePin, OUTPUT);
digitalWrite(enablePin, HIGH);
#endif // enablePin
// Start communication
DEBUG_STREAM.begin(baud);
MODEM_STREAM.begin(baud);
}
// Forward every message to the other serial
void loop()
{
while (DEBUG_STREAM.available())
{
MODEM_STREAM.write(DEBUG_STREAM.read());
}
while (MODEM_STREAM.available())
{
DEBUG_STREAM.write(MODEM_STREAM.read());
}
#ifndef ARDUINO_AVR_SODAQ_MBILI
// check if the USB virtual serial wants a new baud rate
if (DEBUG_STREAM.baud() != baud) {
baud = DEBUG_STREAM.baud();
MODEM_STREAM.begin(baud);
}
#endif // !ARDUINO_AVR_SODAQ_MBILI
}

View File

@@ -22,13 +22,48 @@
#include <Sodaq_wdt.h>
#ifdef ARDUINO_SODAQ_EXPLORER
/* SODAQ Explorer + SODAQ NB-IoT Shield */
#define DEBUG_STREAM SerialUSB
#define MODEM_ON_OFF_PIN 7
#define MODEM_STREAM Serial
#elif defined(ARDUINO_SAM_ZERO)
/* Arduino Zero / M0 + SODAQ NB-IoT Shield */
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial1
#define MODEM_ON_OFF_PIN 7
#elif defined(ARDUINO_AVR_LEONARDO)
/* Arduino Leonardo + SODAQ NB-IoT Shield */
#define DEBUG_STREAM Serial
#define MODEM_STREAM Serial1
#define MODEM_ON_OFF_PIN 7
#elif defined(ARDUINO_SODAQ_AUTONOMO)
/* SODAQ AUTONOMO + SODAQ NB-IoT Bee */
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial1
#define MODEM_ON_OFF_PIN BEE_VCC
#define MODEM_DTR BEEDTR
#elif defined(ARDUINO_AVR_SODAQ_MBILI)
/* SODAQ MBILI + SODAQ NB-IoT Bee */
#define DEBUG_STREAM Serial
#define MODEM_STREAM Serial1
#define MODEM_DTR BEEDTR
#elif defined(ARDUINO_SODAQ_SARA)
/* SODAQ SARA */
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial1
#define MODEM_ON_OFF_PIN SARA_ENABLE
#define MODEM_DTR SARA_TX_ENABLE
#else
#error "You need to declare the modem on/off pin and stream for your particular board!"
#endif
#define DEBUG_STREAM SerialUSB
#define DEBUG_STREAM_BAUD 115200
#define STARTUP_DELAY 5000
@@ -50,9 +85,43 @@ void setup()
DEBUG_STREAM.print("Initializing and connecting... ");
#ifdef MODEM_DTR
// Set state to active
pinMode(MODEM_DTR, OUTPUT);
digitalWrite(MODEM_DTR, HIGH);
#endif // MODEM_DTR
nbiot.init(MODEM_STREAM, MODEM_ON_OFF_PIN);
nbiot.setDiag(DEBUG_STREAM);
connectModem();
}
void loop()
{
if (nbiot.isConnected()) {
const char* message = "Hello World!";
DEBUG_STREAM.print("Sending message: \"");
DEBUG_STREAM.print(message);
DEBUG_STREAM.print("\"... ");
if (!nbiot.sendMessage(message)) {
DEBUG_STREAM.println("Could not queue message!");
}
else {
DEBUG_STREAM.println("Message queued for transmission!");
}
showMessageCountFromModem();
}
else {
connectModem();
}
sodaq_wdt_safe_delay(5000);
}
void connectModem() {
if (nbiot.connect(apn, cdp, forceOperator)) {
DEBUG_STREAM.println("Connected succesfully!");
}
@@ -60,29 +129,6 @@ void setup()
DEBUG_STREAM.println("Failed to connect!");
return;
}
showMessageCountFromModem();
const char* message = "Hello World!";
DEBUG_STREAM.print("Sending message: \"");
DEBUG_STREAM.print(message);
DEBUG_STREAM.print("\"... ");
if (!nbiot.sendMessage(message)) {
DEBUG_STREAM.println("Could not queue message!");
}
else {
DEBUG_STREAM.println("Message queued for transmission!");
}
}
void loop()
{
if (nbiot.isConnected()) {
showMessageCountFromModem();
}
sodaq_wdt_safe_delay(5000);
}
void showMessageCountFromModem()