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
Diff: main.cpp
- Revision:
- 3:7ca70581ef20
- Parent:
- 2:dbf7dd3da592
- Child:
- 4:3e2b789c3adc
diff -r dbf7dd3da592 -r 7ca70581ef20 main.cpp --- a/main.cpp Fri Jun 09 11:55:01 2017 +0000 +++ b/main.cpp Fri Jun 09 14:36:07 2017 +0000 @@ -128,8 +128,9 @@ printf("Starting up, please wait up to 180 seconds for network registration to complete...\n"); if (interface->init(PIN)) { pulseEvent(); + interface->set_credentials(APN, USERNAME, PASSWORD); printf("Registered, connecting to the packet network...\n"); - for (x = 0; interface->connect(PIN, APN, USERNAME, PASSWORD) != 0; x++) { + for (x = 0; interface->connect() != 0; x++) { if (x > 0) { bad(); printf("Retrying (have you checked that an antenna is plugged in and your APN is correct?)...\n"); @@ -211,7 +212,7 @@ printf("Socket closed.\n"); } wait_ms(5000); - printf("[Checking user button]\n"); + printf("[Checking if user button has been pressed]\n"); } pulseEvent();