example-ublox-cellular-interface
Dependencies: ublox-at-cellular-interface ublox-cellular-base ublox-cellular-base-n2xx ublox-at-cellular-interface-n2xx
Diff: main.cpp
- Revision:
- 43:c8ae646bed51
- Parent:
- 38:e09e02c31ba1
--- a/main.cpp Fri Nov 08 10:29:06 2019 +0000 +++ b/main.cpp Fri Nov 08 15:35:59 2019 +0500 @@ -153,13 +153,17 @@ #else InterruptIn userButton(SW0); #endif - + // Attach a function to the user button userButton.rise(&cbButton); - + good(); printf("Starting up, please wait up to 180 seconds for network registration to complete...\n"); interface->set_credentials(APN, USERNAME, PASSWORD); +#ifdef TARGET_UBLOX_C030_R41XM + interface->init(PIN); + interface->disable_power_saving_mode(); //Please use PSM example to test PSM functionality(https://os.mbed.com/teams/ublox/code/example-ublox-cellular-psm/) +#endif for (x = 0; interface->connect(PIN) != 0; x++) { if (x > 0) { bad(); @@ -167,7 +171,7 @@ } } pulseEvent(); - + printf("Getting the IP address of \"developer.mbed.org\" and \"2.pool.ntp.org\"...\n"); if ((interface->gethostbyname("2.pool.ntp.org", &udpServer) == 0) && (interface->gethostbyname(TCP_SERVER, &tcpServer) == 0)) { @@ -202,13 +206,13 @@ printNtpTime(buf, x); printf("-------------------------------------------------------\n"); } - } + } printf("Closing socket...\n"); sockUdp.close(); pulseEvent(); printf("Socket closed.\n"); } - + #ifndef TARGET_UBLOX_C030_N211 // TCP Sockets printf("=== TCP ===\n"); @@ -249,7 +253,7 @@ printf("[Checking if user button has been pressed]\n"); #endif } - + pulseEvent(); printf("User button was pressed, stopping...\n"); interface->disconnect();