This code is used to transmit the temperature sensed by the mbed to the xively via wifly. The car is self controlled.

Dependencies:   C12832_lcd WiflyInterface libxively mbed-rtos mbed

Fork of Mode-1_PS2_Wifly_Xively by Bhakti Kulkarni

Files at this revision

API Documentation at this revision

Comitter:
bhakti08
Date:
Mon Jun 09 12:18:36 2014 +0000
Parent:
5:efa4a9eafe7d
Commit message:
Mode1 PS2-Wifly-Xively

Changed in this revision

LM75B.lib Show diff for this revision Revisions of this file
MMA7660.lib Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r efa4a9eafe7d -r 9abfe16d39e0 LM75B.lib
--- a/LM75B.lib	Sat Jun 07 01:04:41 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/chris/code/LM75B/#6a70c9303bbe
diff -r efa4a9eafe7d -r 9abfe16d39e0 MMA7660.lib
--- a/MMA7660.lib	Sat Jun 07 01:04:41 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/Sissors/code/MMA7660/#a8e20db7901e
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