LTE
note
For an API reference, see API Reference/LTE
The LTE module handles all the cellular communication. The API offered to the user allows for starting and stopping cellular communications, as well as registering callback for a disconnect event.
To connect to the cellular network, call Lte.begin()
. When this function returns, the modem is connected to the network. The disconnect callback is registered through the Lte.onDisconnect(discCallback)
call. The callback have the signature void myCallback(void)
.
caution
Remember to connect the Antenna to the board before running any examples that use a wireless feature (i.e LTE, MQTT) or web service (i.e AWS, HTTP)
Example
#include <lte.h>
#include <log.h>
#include <led_ctrl.h>
static volatile bool disconnected_event = false;
void disconnectedFromNetwork(void) {
disconnected_event = true;
}
void setup() {
Log.begin(115200);
LedCtrl.begin();
LedCtrl.startupCycle();
Lte.onDisconnect(disconnectedFromNetwork);
Lte.begin();
}
void loop() {
if (disconnected_event) {
Log.info("Got disconnected!");
disconnected_event = false;
// Do something when disconnected, e.g. reestablish connection...
}
}