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 WiflyInterface libxively mbed-rtos mbed LM75B MMA7660
Fork of IOT-Project-Wifly-Xively by
Diff: main.cpp
- Revision:
- 6:9abfe16d39e0
- Parent:
- 5:efa4a9eafe7d
- Child:
- 7:c7023f76310e
diff -r efa4a9eafe7d -r 9abfe16d39e0 main.cpp
--- a/main.cpp Sat Jun 07 01:04:41 2014 +0000
+++ b/main.cpp Mon Jun 09 12:18:36 2014 +0000
@@ -4,6 +4,7 @@
#include <string.h>
#include "LM75B.h"
#include "MMA7660.h"
+#include "rtos.h"
#define XI_FEED_ID 209829319 // set Xively Feed ID (numerical, no quoutes)
#define XI_API_KEY "T0izYrB6TZVkmhhEWpzs5L7F5wqpJixxc6MtenkLDg3BLMIu" // set Xively API key (double-quoted string)
@@ -13,24 +14,12 @@
#include "C12832_lcd.h"
-#define SEC 1000
-
-#define ECHO_SERVER_PORT 7
-
-
-PwmOut servo(p22);
-DigitalOut dir(LED1);
-//LM75B temp(p28,p27);
-AnalogIn temp(p19);
+LM75B temp(p28,p27);
MMA7660 axl(p28,p27);
Serial pc(USBTX,USBRX);
C12832_LCD lcd;
-#define FWD 1
-#define REV 0
-
-
/* wifly interface:
* - p9 and p10 are for the serial communication
* - p19 is for the reset pin
@@ -42,18 +31,16 @@
//apps board
WiflyInterface wifly(p9, p10, p30, p29, "MY_WIFI", "", NONE);
-//pololu
-//WiflyInterface wifly(p28, p27, p26, NC, "iotlab", "42F67YxLX4AawRdcj", WPA);
+
int main() {
- // char recv[128];
-
wifly.init(); //Use DHCP
pc.printf("1\r\n");
while (!wifly.connect());
pc.printf("IP Address is %s\n\r", wifly.getIPAddress());
+
xi_feed_t feed;
memset( &feed, NULL, sizeof( xi_feed_t ) );
@@ -73,10 +60,12 @@
exit (0);
}
-
- while (true) {
+ while (true) {
+ pc.printf("In xively thread\r\n");
xi_set_value_f32( current_temperature, temp.read() );
+ pc.printf("Value set\r\n");
xi_feed_update( xi_context, &feed );
- wait(10.0);
+ pc.printf("Update\r\n");
+ wait(10);
}
}
\ No newline at end of file
