see main.cpp for - feed id - api key Go here to see live feed: https://xively.com/develop/WtDQf4yIsG2jnz4gE1-z If MBED connected to Ethernet- you will see live data feed. xively login avnisha Bubbles1231

Dependencies:   C12832_lcd EthernetInterface LM75B MMA7660 mbed-libxively-6eca970 mbed-rtos mbed

Fork of xively-jumpstart-demo by Xively Official

Files at this revision

API Documentation at this revision

Comitter:
avnisha
Date:
Tue Sep 24 22:40:17 2013 +0000
Parent:
5:04b5c5242bbf
Commit message:
ok

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 04b5c5242bbf -r 9af362ececc4 main.cpp
--- a/main.cpp	Wed Jun 26 11:55:36 2013 +0000
+++ b/main.cpp	Tue Sep 24 22:40:17 2013 +0000
@@ -1,17 +1,64 @@
+#define ETHERNET
+
+#ifdef WIFLY
+#include "mbed.h"
+#include "WiflyInterface.h"
+
+Serial pc(USBTX, USBRX);
+
+/* wifly object where:
+*     - p9 and p10 are for the serial communication
+*     - p25 is for the reset pin
+*     - p26 is for the connection status
+*     - "mbed" is the ssid of the network
+*     - "password" is the password
+*     - WPA is the security
+*/
+WiflyInterface wifly(p9, p10, p25, p26, "bubbles", "", NONE);
+
+int main() {
+    printf("hello\n\r");
+    wifly.init(); // use DHCP
+    while (!wifly.connect()); // join the network
+    printf("IP Address is %s\n\r", wifly.getIPAddress());
+    while (1) {}
+    wifly.disconnect();
+}
+
+#endif
+
 #include "mbed.h"
 #include "EthernetInterface.h"
 #include "xively.h"
 #include "xi_err.h"
 #include "xi_printf.h"
 
+#ifdef WIFLY
+#include "WiflyInterface.h"
+
+Serial pc(USBTX, USBRX);
+
+/* wifly object where:
+*     - p9 and p10 are for the serial communication
+*     - p25 is for the reset pin
+*     - p26 is for the connection status
+*     - "mbed" is the ssid of the network
+*     - "password" is the password
+*     - WPA is the security
+*/
+WiflyInterface wifly(p9, p10, p25, p26, "bubbles", "", NONE);
+#endif
+
 #include <stdarg.h>
 #include <stdio.h>
 
 #include "MMA7660.h"
 #include "LM75B.h"
 
-#define XI_FEED_ID 123 // set Xively Feed ID (numerical, no quoutes
-#define XI_API_KEY "T4KXAH_dasgw1PWBPc3fdsfsdgsdy-dUc4ND0g" // set Xively API key (double-quoted string) 
+// 332668647
+// ZmCG3GmfnJzvt1LZnLdHfS9D5vlfNrXQSxKD1jpzqsAsp3bh
+#define XI_FEED_ID 332668647 // set Xively Feed ID (numerical, no quoutes
+#define XI_API_KEY "ZmCG3GmfnJzvt1LZnLdHfS9D5vlfNrXQSxKD1jpzqsAsp3bh" // set Xively API key (double-quoted string) 
 
 #include "C12832_lcd.h"
 
@@ -47,7 +94,8 @@
 int main() {
     // set our device specific print function
     USER_PRINT = user_printf;
-    
+
+#ifdef ETHERNET    
     EthernetInterface eth;
     
     int s = eth.init(); //Use DHCP
@@ -69,7 +117,12 @@
     {
         mbed_printf( "IP: %s\n", eth.getIPAddress() );    
     }
-    
+#else
+    wifly.init(); // use DHCP
+    while (!wifly.connect()); // join the network
+    printf("IP Address is %s\n\r", wifly.getIPAddress());
+#endif
+
     xi_feed_t feed;
     memset( &feed, NULL, sizeof( xi_feed_t ) );