Example programs for MultiTech Dragonfly devices demonstrating how to use the MultiTech MTSCellularInterface library for cellular radio communication and control.
Library Not Included!
The MTSCellularInterface library is not included and must be cloned from GitHub.
mbed-os version
The MTSCellularInterface library does not currently support mbed-os-5.5.x releases. We recommend using mbed-os version 5.4.7.
Example Programs Description
This application contains multiple example programs. Each example demonstrates a different way to configure and use a Dragonfly. A short summary of each example is provided below.
All examples print logging on the USB debug port at 115200 baud.
Most cellular radios require an APN to be set before the radio can be used. Please set the APN in the example you're using before trying to run it. The SMS example also requires a phone number to be set. The number should be in 10 digit format (1xxxyyyxxxx).
TCP Example
This example demonstrates how to use MTSCellularInterface to make TCP socket connections. It brings up the cellular link, does a HTTP GET request on http://developer.mbed.org, and displays the response.
The APN must be set in the TCP example source code before this example is run.
SMS Example
This example demonstrates how to use MTSCellularInterface to send and receive SMS messages. It brings up the cellular link, sends a SMS message to the configured phone number, then loops forever displaying any received SMS messages.
The APN and phone number must be set in the SMS example source code before this example is run.
Choosing An Example Program
Only the active example is compiled. The active example can be updated by changing the ACTIVE_EXAMPLE definition in the examples/example_config.h file.
By default the TCP example will be compiled.
example_config.h
// This is where you choose which example program will be compiled // to run on the target device. #ifndef __EXAMPLE__CONFIG_H__ #define __EXAMPLE__CONFIG_H__ // List of available example programs. #define SMS_EXAMPLE 1 // see sms_example.cpp #define TCP_EXAMPLE 2 // see tcp_example.cpp // Example program that will be compiled to run on target. #if !defined(ACTIVE_EXAMPLE) #define ACTIVE_EXAMPLE TCP_EXAMPLE #endif #endif
Compile the SMS example instead.
example_config.h
// This is where you choose which example program will be compiled // to run on the target device. #ifndef __EXAMPLE__CONFIG_H__ #define __EXAMPLE__CONFIG_H__ // List of available example programs. #define SMS_EXAMPLE 1 // see sms_example.cpp #define TCP_EXAMPLE 2 // see tcp_example.cpp // Example program that will be compiled to run on target. #if !defined(ACTIVE_EXAMPLE) #define ACTIVE_EXAMPLE SMS_EXAMPLE #endif #endif
Library
The MTSCellularInterface library can be cloned from MultiTech's GitHub page.
Revisions of examples/example_config.h
Revision | Date | Message | Actions |
---|---|---|---|
1:be566f16398d | 2017-06-21 | fix bad header in examples. print library version in examples. example_config will not redefine ACTIVE_EXAMPLE if it's already defined | File Diff Annotate |
0:2c9b8730c55d | 2017-06-13 | Initial commit | File Diff Annotate |