Xively Jumpstart Demo with WiFly module

Dependencies:   C12832_lcd LM75B MMA7660 WiflyInterface libxively mbed-rtos mbed

Deprecated

This is an mbed 2 example. For an mbed-os WiFi example, see:

[Repository '/teams/mbed-os-examples/code/mbed-os-example-wifi/docs/tip/' not found]

Files at this revision

API Documentation at this revision

Comitter:
xively
Date:
Fri Oct 11 12:39:08 2013 +0000
Parent:
5:04b5c5242bbf
Child:
8:81743e1228a7
Commit message:
Update to use latest version of libxively (in sync with git)

Changed in this revision

app_board_io.cpp Show annotated file Show diff for this revision Revisions of this file
app_board_io.h Show annotated file Show diff for this revision Revisions of this file
libxively.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-libxively-6eca970.lib Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app_board_io.cpp	Fri Oct 11 12:39:08 2013 +0000
@@ -0,0 +1,18 @@
+#include "app_board_io.h"
+
+C12832_LCD lcd;
+
+extern "C" void lcd_printf( const char* fmt, ...  )
+{
+    char buffer[ 64 ];
+    
+    va_list ap;
+    va_start( ap, fmt );
+    vsnprintf( buffer, 64, fmt, ap );
+    va_end( ap );
+    
+    lcd.cls();
+    lcd.locate( 0, 3 );
+    lcd.printf( buffer );
+    //wait( 1.0 );
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app_board_io.h	Fri Oct 11 12:39:08 2013 +0000
@@ -0,0 +1,9 @@
+#include "MMA7660.h"
+#include "LM75B.h"
+
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "C12832_lcd.h"
+
+extern "C" void lcd_printf( const char* fmt, ...  );
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libxively.lib	Fri Oct 11 12:39:08 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/xively/code/libxively/#037241ec3163
--- a/main.cpp	Wed Jun 26 11:55:36 2013 +0000
+++ b/main.cpp	Fri Oct 11 12:39:08 2013 +0000
@@ -1,52 +1,22 @@
 #include "mbed.h"
 #include "EthernetInterface.h"
+
+#define XI_FEED_ID 128488 // set Xively Feed ID (numerical, no quoutes
+#define XI_API_KEY "T4KXAH_dasgw1PWBPc3fdsfsdgsdy-dUc4ND0g" // set Xively API key (double-quoted string) 
+
+#include "app_board_io.h"
+
+#define XI_DEBUG_PRINTF lcd_printf
+#define XI_DEBUG_OUTPUT 1
+#define XI_DEBUG_ASSERT 0
+
 #include "xively.h"
 #include "xi_err.h"
-#include "xi_printf.h"
-
-#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) 
-
-#include "C12832_lcd.h"
-
-C12832_LCD lcd;
 
 MMA7660 axl(p28, p27);
 LM75B tmp(p28, p27);
 
-extern "C" {
-
-void user_printf( const char* buffer )
-{
-    lcd.cls();
-    lcd.locate( 0, 3 );
-    lcd.printf( buffer );
-    //wait( 1.0 );    
-}
-
-void mbed_printf( const char* fmt, ...  )
-{
-    char buffer[ 64 ];
-    
-    va_list ap;
-    va_start( ap, fmt );
-    vsnprintf( buffer, 64, fmt, ap );
-    va_end( ap );
-    
-    user_printf( buffer );
-}
-
-}
-
 int main() {
-    // set our device specific print function
-    USER_PRINT = user_printf;
     
     EthernetInterface eth;
     
@@ -54,7 +24,7 @@
     
     if( s != NULL )
     {
-        mbed_printf( "Could not initialise. Will halt!\n" );        
+        lcd_printf( "Could not initialise. Will halt!\n" );        
         exit( 0 );
     }    
         
@@ -62,12 +32,12 @@
     
     if( s != NULL )
     {
-        mbed_printf( "Could not connect. Will halt!\n" );
+        lcd_printf( "Could not connect. Will halt!\n" );
         exit( 0 );
     }
     else 
     {
-        mbed_printf( "IP: %s\n", eth.getIPAddress() );    
+        lcd_printf( "IP: %s\n", eth.getIPAddress() );    
     }
     
     xi_feed_t feed;
@@ -101,7 +71,7 @@
         return -1;
     }
     
-    mbed_printf("feed:%d datastreams:[%s,%s]\n", feed.feed_id,
+    lcd_printf("feed:%d datastreams:[%s,%s]\n", feed.feed_id,
                     orientation_datastream->datastream_id,
                     side_rotation_datastream->datastream_id);
 
@@ -121,22 +91,22 @@
       
       switch( axl.getOrientation() ) {
         case MMA7660::Down:
-          mbed_printf("down %s\n",
+          lcd_printf("down %s\n",
             (axl.getSide() == MMA7660::Front ? "front" : "back"));
           xi_set_value_str( current_orientation, "down" );
           break;
         case MMA7660::Up:
-           mbed_printf("up %s\n",
+           lcd_printf("up %s\n",
             (axl.getSide() == MMA7660::Front ? "front" : "back"));
            xi_set_value_str( current_orientation, "up" );
            break;
         case MMA7660::Right:
-          mbed_printf("right %s\n",
+          lcd_printf("right %s\n",
             (axl.getSide() == MMA7660::Front ? "front" : "back"));
           xi_set_value_str( current_orientation, "right" );
           break;
         case MMA7660::Left:
-          mbed_printf("left %s\n",
+          lcd_printf("left %s\n",
             (axl.getSide() == MMA7660::Front ? "front" : "back"));
           xi_set_value_str( current_orientation, "left" );
           break;
@@ -147,9 +117,9 @@
       
       xi_set_value_f32( current_temperature, tmp.read() );
         
-      mbed_printf( "update...\n" );
+      lcd_printf( "update...\n" );
       xi_feed_update(xi_context, &feed);
-      mbed_printf( "done...\n" );
+      lcd_printf( "done...\n" );
       
       wait( 15.0 );
     }
--- a/mbed-libxively-6eca970.lib	Wed Jun 26 11:55:36 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/xively/code/mbed-libxively-6eca970/#82702e998d3f