tst
Dependencies: C12832_lcd EthernetInterface LM75B MMA7660 mbed-libxively-6eca970 mbed-rtos mbed
Fork of Application-xively-jumpstart-demo by
Diff: main.cpp
- Revision:
- 6:9af362ececc4
- Parent:
- 4:e7ca62a11595
- Child:
- 7:ffaea0d21d77
--- 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 ) );