example application with TFT display and SMS receive send
Dependencies: C027 C027_Support SeeedStudioTFTv2 TFT_fonts UbloxUSBModem mbed
Fork of C027_DisplayTest by
This is an application that combines several libraries together and demonstartes the use of cellular, GPS and a Touch enabled TFT on the u-blox C027 board.
Diff: main.cpp
- Revision:
- 9:e3dd986ab08c
- Parent:
- 8:98b713c10d30
- Child:
- 10:2b1e6015e413
--- a/main.cpp Fri Dec 06 14:04:48 2013 +0000 +++ b/main.cpp Tue Dec 17 16:36:11 2013 +0000 @@ -9,8 +9,7 @@ #include "Arial28x28.h" #include "font_big.h" -#include "UbloxUSBGSMModem.h" -#include "UbloxUSBCDMAModem.h" +#include "UbloxModem.h" void ubxLogo(SPI_TFT_ILI9341* tft, int x0/*160*/, int y0/*160*/, int r) { @@ -51,18 +50,20 @@ TFT.printf("u-blox C027-C20/U20/G35"); C027 c027; - c027.mdmUsbEnable(true); + //c027.mdmUsbEnable(true); // disable this is you plan to use the Serial port on LISA-C c027.mdmPower(true); c027.gpsPower(true); GPSSerial gps; - UbloxUSBGSMModem modem; + //UbloxUSBModem modem; // LISA-U or LISA-C, don't forget to call the mdmUsbEnable above + UbloxSerModem modem; // LISA-U, LISA-C or SARA-G size_t count; #define MY_IMEI "+41799613242" info(" Cellular Modem\n IMEI: %s", MY_IMEI); char num[17] = "", msg[160+1] = ""; + char link[160] = ""; clock_t c = clock(); while(true) { @@ -98,6 +99,10 @@ if(!modem.getSM(num, msg, sizeof(msg))) { info(" From: %s\n SMS:%s", num, msg); + if (0 == strcmp(msg, "Where are you?") && *link) + { + modem.sendSM(num, link); + } } } c = n; @@ -140,6 +145,7 @@ TFT.printf("%11.6f ", la); TFT.locate(220,199); TFT.printf("%11.6f ", lo); + sprintf(link, "https://maps.google.com/?q=%.5f,%.5f", la, lo); } } }