Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: C12832_lcd EthernetInterface LM75B MMA7660 mbed-libxively-6eca970 mbed-rtos mbed
Fork of Application-xively-jumpstart-demo by
Revision 6:9af362ececc4, committed 2013-09-24
- Comitter:
- avnisha
- Date:
- Tue Sep 24 22:40:17 2013 +0000
- Parent:
- 5:04b5c5242bbf
- Child:
- 7:382c67265a5d
- Commit message:
- ok
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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 ) );
