Contains example code to connect the mbed LPC1768 or FRDM-K64F devices to the IBM Internet of Things Cloud service via ethernet.

Dependencies:   C12832 MQTT LM75B MMA7660

Dependents:   MFT_IoT_demo_USB400 IBM_RFID

Files at this revision

API Documentation at this revision

Comitter:
mazgch
Date:
Tue Mar 10 08:24:52 2015 +0000
Parent:
10:0b5e0dfee08e
Child:
12:8b480eb8a496
Commit message:
enable the C027

Changed in this revision

C027.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/C027.h	Mon Oct 20 14:37:33 2014 +0000
+++ b/C027.h	Tue Mar 10 08:24:52 2015 +0000
@@ -18,6 +18,9 @@
 #define K64F_H
 
 C12832 lcd(D11, D13, D12, D7, D10);
+PwmOut r(D5);
+PwmOut g(D9);
+PwmOut b(D8);
 DigitalOut led1(LED1); DigitalOut led2(LED2); DigitalOut led3(LED3);
 MMA7660 MMA(D14, D15);
 LM75B sensor(D14,D15);
@@ -29,4 +32,11 @@
 
 #define DEFAULT_TYPE_NAME "iotsample-mbed-c027"
 
+#include "lpc_phy.h"
+// need a wrapper since K64F and LPC1768 wont have the same name for mii read methods
+static uint32_t linkStatus(void)
+{
+    return (lpc_mii_read_data() & 1);
+}
+
 #endif
\ No newline at end of file
--- a/main.cpp	Mon Oct 20 14:37:33 2014 +0000
+++ b/main.cpp	Tue Mar 10 08:24:52 2015 +0000
@@ -44,7 +44,10 @@
 
 #define MQTT_MAX_PACKET_SIZE 250
 
-#if defined(TARGET_LPC1768)
+#if defined(TARGET_UBLOX_C027)
+#warning "Compiling for mbed C027"
+#include "C027.h"
+#elif defined(TARGET_LPC1768)
 #warning "Compiling for mbed LPC1768"
 #include "LPC1768.h"
 #elif defined(TARGET_K64F)
@@ -194,6 +197,7 @@
     
     char hostname[strlen(org) + strlen(iot_ibm) + 1];
     sprintf(hostname, "%s%s", org, iot_ibm);
+    DEBUG("hostname is %s\n", hostname);
     int rc = ipstack->connect(hostname, IBM_IOT_PORT);
     if (rc != 0)
         return rc;