Example program that uses the mbed UbloxATCellularInterface or OnboardCellularInterface classes to perform simple sockets operations. This program can be used on the C027 and C030 boards, including the C030 N2xx version with a little editing.

Dependencies:   ublox-at-cellular-interface ublox-cellular-base ublox-cellular-base-n2xx ublox-at-cellular-interface-n2xx

Files at this revision

API Documentation at this revision

Comitter:
RobMeades
Date:
Mon Jun 12 09:09:13 2017 +0000
Parent:
3:7ca70581ef20
Child:
5:bf352de1d3e5
Commit message:
Make example work for C027.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Jun 09 14:36:07 2017 +0000
+++ b/main.cpp	Mon Jun 12 09:09:13 2017 +0000
@@ -112,6 +112,11 @@
 int main()
 {
     UbloxATCellularInterface *interface = new UbloxATCellularInterface();
+// If you need to debug the cellular interface, comment out the
+// instantiation above and uncomment the one below.
+//    UbloxATCellularInterface *interface = new UbloxATCellularInterface(MDMTXD, MDMRXD,
+//                                                                       MBED_CONF_UBLOX_CELL_BAUD_RATE,
+//                                                                       true);
     TCPSocket sockTcp;
     UDPSocket sockUdp;
     SocketAddress udpServer;
@@ -119,7 +124,12 @@
     SocketAddress tcpServer;
     char buf[1024];
     int x;
+#ifdef TARGET_UBLOX_C027
+    // No user button on C027
+    InterruptIn userButton(NC);
+#else
     InterruptIn userButton(SW0);
+#endif
     
     // Attach a function to the user button
     userButton.rise(&cbButton);
@@ -147,7 +157,7 @@
             printf("\"2.pool.ntp.org\" address: %s on port %d.\n", udpServer.get_ip_address(), udpServer.get_port());
             printf("\"developer.mbed.org\" address: %s on port %d.\n", tcpServer.get_ip_address(), tcpServer.get_port());
             
-            printf("Performing socket operations in a loop until the user button is pressed...\n");
+            printf("Performing socket operations in a loop (until the user button is pressed on C030 or forever on C027)...\n");
             while (!buttonPressed) {
                 // UDP Sockets
                 printf("=== UDP ===\n");
--- a/mbed-os.lib	Fri Jun 09 14:36:07 2017 +0000
+++ b/mbed-os.lib	Mon Jun 12 09:09:13 2017 +0000
@@ -1,1 +1,1 @@
-https://github.com/u-blox/mbed-os/#66cee1c02baf29d6b17c3778b6767592b9cbfd60
+https://github.com/u-blox/mbed-os/#f165ba1341337ef6219404a201af6b0f36605cba