Example showing the ublox Cellular GPS/GNSS module with the online PubNub service on an LPC4088 Experiment Base Board
Dependencies: C027_Support C12832 EALib LM75B MMA7660 PubNub mbed-rtos mbed picojson
Diff: PubNubDemo.cpp
- Revision:
- 2:5f22df5ec656
- Parent:
- 0:e2c6c039dfbe
- Child:
- 4:84e8940cf7ef
diff -r 6089a521fcc6 -r 5f22df5ec656 PubNubDemo.cpp --- a/PubNubDemo.cpp Thu Mar 13 03:38:52 2014 +0000 +++ b/PubNubDemo.cpp Tue May 13 08:44:48 2014 +0000 @@ -1,14 +1,37 @@ #include <cstring> #include "mbed.h" -#include "EthernetInterface.h" -#include "C12832_lcd.h" +#include "C12832.h" #include "MMA7660.h" #include "LM75B.h" #include "picojson.h" #include "PubNub.h" +#include "C027.h" +#include "MDM.h" + +//---------------------------------------------------------------------- +// You may need to configure these parameters + +/** Set your secret SIM pin here "1234" +*/ +#define SIMPIN NULL + +/** The APN of your network operator, sometimes it is "internet" + check your contract with the network operator +*/ +#define APN "gprs.swisscom.ch" + +/** Set the user name for your APN, or NULL if not needed +*/ +#define USERNAME NULL + +/** Set the password for your APN, or NULL if not needed +*/ +#define PASSWORD NULL + +C027 c027; /* Demo of PubNub + the mbed application board. */ @@ -37,16 +60,15 @@ */ Serial pc(USBTX, USBRX); // tx, rx -C12832_LCD lcd; // Graphics LCD -MMA7660 MMA(p28, p27); // I2C Accelerometer -LM75B tmp(p28,p27); // I2C Temperature Sensor +MMA7660 MMA(SDA, SCL); +LM75B tmp(SDA, SCL); +C12832 lcd(D11, D13, D12, D7, D10); -PwmOut led_r(p23); // RGB LED with 3 PWM outputs for dimmer control -PwmOut led_g(p24); -PwmOut led_b(p25); -PwmOut speaker(p26); // Speaker with PWM driver +PwmOut led_r(D5); // RGB LED with 3 PWM outputs for dimmer control +PwmOut led_g(D9); +PwmOut led_b(D8); +PwmOut speaker(D6); // Speaker with PWM driver -EthernetInterface eth; PubNub pn(pubkey, subkey); void status_msg(PubNub &pn) @@ -133,8 +155,12 @@ if (!MMA.testConnection()) lcd.printf("MMA error \n"); - eth.init(); // Use DHCP - eth.connect(); + // turn on the supplies of the Modem and the GPS + c027.mdmPower(true); + printf("Modem Initialize\r\n"); + MDMSerial mdm; + if (!mdm.connect(SIMPIN, APN,USERNAME,PASSWORD, true)) + return -1; status_msg(pn); // lcd.printf("pub... "); @@ -158,4 +184,8 @@ wait(0.5); // avoid busy loop in bad situations } + + mdm.disconnect(); + mdm.powerOff(); + c027.mdmPower(false); } \ No newline at end of file