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:
errordeveloper
Date:
Mon Oct 14 13:33:04 2013 +0000
Parent:
10:86ffba646df1
Child:
12:e07c2779c6fb
Commit message:
Improve a few things about the LCD output:; ; * don't output debug logs; * show Xively logo on boot;

Changed in this revision

app_board_io.cpp Show annotated file Show diff for this revision Revisions of this file
logo.h 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
xi_user_config.h Show annotated file Show diff for this revision Revisions of this file
--- a/app_board_io.cpp	Mon Oct 14 12:08:18 2013 +0000
+++ b/app_board_io.cpp	Mon Oct 14 13:33:04 2013 +0000
@@ -1,7 +1,7 @@
 #include "app_board_io.h"
 #include "C12832_lcd.h"
 
-C12832_LCD lcd;
+extern C12832_LCD lcd;
 
 extern "C" void lcd_printf( const char* fmt, ...  )
 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/logo.h	Mon Oct 14 13:33:04 2013 +0000
@@ -0,0 +1,55 @@
+static char xively_logo_data[] = {
+  0x0,   0x0,   0x0,   0x0,   0x0,   0x0,   0x0,  0x0,
+  0x0,   0x0,   0x0,   0x0,   0x0,   0x0,   0x0,  0x0,
+  0x0,   0x0,   0x0,   0x0,   0x0,   0x0,   0x1c, 0x0,
+  0x0,   0x0,   0x0,   0xe0,  0x0,   0x0,   0x0,  0x0,
+  0x3e,  0x0,   0x0,   0x0,   0x0,   0xf0,  0x0,  0x0,
+  0x0,   0x0,   0x3e,  0x0,   0x0,   0x0,   0x0,  0xf0,
+  0x0,   0x0,   0x0,   0x0,   0x1c,  0x0,   0x0,  0x0,
+  0x0,   0xf0,  0x0,   0x0,   0x0,   0x0,   0x0,  0x0,
+  0x0,   0x0,   0x0,   0xf0,  0x0,   0x0,   0x0,  0x0,
+  0x0,   0x0,   0x0,   0x0,   0x0,   0xf0,  0x0,  0x0,
+  0x10,  0x0,   0x0,   0x0,   0x0,   0xf,   0xc0, 0xf0,
+  0x0,   0x0,   0x1e,  0x7,   0x9c,  0xf0,  0x1e, 0x3f,
+  0xf0,  0xf7,  0x80,  0x78,  0xf,   0xf,   0x1c, 0xf0,
+  0x1e,  0x7f,  0xf8,  0xf7,  0x80,  0xf0,  0x7,  0x9e,
+  0x1c,  0xf0,  0x1e,  0xf8,  0x78,  0xf3,  0xc0, 0xf0,
+  0x7,   0x9e,  0x1c,  0x78,  0x3c,  0xf0,  0x3c, 0xf3,
+  0xc0,  0xe0,  0x3,   0xfc,  0x1c,  0x78,  0x3d, 0xe0,
+  0x1c,  0xf3,  0xc1,  0xe0,  0x1,   0xf8,  0x1c, 0x38,
+  0x39,  0xe0,  0x1c,  0xf1,  0xe1,  0xe0,  0x1,  0xf8,
+  0x1c,  0x3c,  0x79,  0xff,  0xfe,  0xf1,  0xe3, 0xc0,
+  0x1,   0xf8,  0x1c,  0x3c,  0x79,  0xff,  0xfe, 0xf0,
+  0xe3,  0xc0,  0x1,   0xf8,  0x1c,  0x1e,  0xf1, 0xe0,
+  0x0,   0xf0,  0xf3,  0x80,  0x3,   0xfc,  0x1c, 0x1e,
+  0xf1,  0xe0,  0x0,   0xf0,  0x77,  0x80,  0x7,  0x9e,
+  0x1c,  0xf,   0xe0,  0xf0,  0x0,   0xf0,  0x7f, 0x80,
+  0x7,   0x8f,  0x1c,  0xf,   0xe0,  0xf8,  0x10, 0xf0,
+  0x7f,  0x0,   0xf,   0xf,   0x1c,  0xf,   0xe0, 0x7f,
+  0xf8,  0xf0,  0x3f,  0x0,   0x1e,  0x7,   0x9c, 0x7,
+  0xc0,  0x3f,  0xf8,  0xf0,  0x3e,  0x0,   0x3e, 0x3,
+  0xdc,  0x7,   0xc0,  0x1f,  0xe0,  0xf0,  0x1e, 0x0,
+  0x0,   0x0,   0x0,   0x0,   0x0,   0x0,   0x0,  0x0,
+  0x1e,  0x0,   0x0,   0x0,   0x0,   0x0,   0x0,  0x0,
+  0x0,   0x0,   0x3c,  0x0,   0x0,   0x0,   0x0,  0x0,
+  0x0,   0x0,   0x0,   0x0,   0x3c,  0x0,   0x0,  0x0,
+  0x0,   0x0,   0x0,   0x0,   0x0,   0x1,   0xf8, 0x0,
+  0x0,   0x0,   0x0,   0x0,   0x0,   0x0,   0x0,  0x1,
+  0xf8,  0x0,   0x0,   0x0,   0x0,   0x0,   0x0,  0x0,
+  0x0,   0x1,   0xf0,  0x0,   0x0,   0x0,   0x0,  0x0,
+  0x0,   0x0,   0x0,   0x0,   0x0,   0x0,   0x0,  0x0,
+  0x0,   0x0,   0x0,   0x0,   0x0,   0x0,   0x0,  0x0
+};
+
+inline void lcd_print_xively_logo() {
+  static Bitmap xively_logo = { 80, 32, 10, xively_logo_data };
+  lcd.cls();
+  lcd.print_bm(xively_logo, 24, 0);
+  lcd.copy_to_lcd();  
+  for(int i = -32; i < 32; i++){ 
+    lcd.cls();
+    lcd.print_bm(xively_logo, 24, i);
+    lcd.copy_to_lcd(); 
+    wait(0.1);
+  }
+}
\ No newline at end of file
--- a/main.cpp	Mon Oct 14 12:08:18 2013 +0000
+++ b/main.cpp	Mon Oct 14 13:33:04 2013 +0000
@@ -1,7 +1,7 @@
 #include "mbed.h"
 #include "EthernetInterface.h"
 
-#define XI_FEED_ID 128488 // set Xively Feed ID (numerical, no quoutes
+#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"
@@ -11,12 +11,16 @@
 
 #include "MMA7660.h"
 #include "LM75B.h"
+#include "C12832_lcd.h"
 
 MMA7660 axl(p28, p27);
 LM75B tmp(p28, p27);
+C12832_LCD lcd;
+
+#include "logo.h"
 
 int main() {
-    
+    lcd_print_xively_logo();
     EthernetInterface eth;
     
     int s = eth.init(); //Use DHCP
@@ -69,10 +73,6 @@
     {
         return -1;
     }
-    
-    lcd_printf("feed:%d datastreams:[%s,%s]\n", feed.feed_id,
-                    orientation_datastream->datastream_id,
-                    side_rotation_datastream->datastream_id);
 
     while(1) {
       
@@ -90,23 +90,15 @@
       
       switch( axl.getOrientation() ) {
         case MMA7660::Down:
-          lcd_printf("down %s\n",
-            (axl.getSide() == MMA7660::Front ? "front" : "back"));
           xi_set_value_str( current_orientation, "down" );
           break;
         case MMA7660::Up:
-           lcd_printf("up %s\n",
-            (axl.getSide() == MMA7660::Front ? "front" : "back"));
            xi_set_value_str( current_orientation, "up" );
            break;
         case MMA7660::Right:
-          lcd_printf("right %s\n",
-            (axl.getSide() == MMA7660::Front ? "front" : "back"));
           xi_set_value_str( current_orientation, "right" );
           break;
         case MMA7660::Left:
-          lcd_printf("left %s\n",
-            (axl.getSide() == MMA7660::Front ? "front" : "back"));
           xi_set_value_str( current_orientation, "left" );
           break;
         default: 
@@ -117,7 +109,7 @@
       xi_set_value_f32( current_temperature, tmp.read() );
         
       lcd_printf( "update...\n" );
-      xi_feed_update(xi_context, &feed);
+      xi_feed_update( xi_context, &feed );
       lcd_printf( "done...\n" );
       
       wait( 15.0 );
--- a/xi_user_config.h	Mon Oct 14 12:08:18 2013 +0000
+++ b/xi_user_config.h	Mon Oct 14 13:33:04 2013 +0000
@@ -14,7 +14,7 @@
 // If you wish to enable assertions, set this to 1
 #define XI_DEBUG_ASSERT 0
 // If you wish to disable debug output, set this to 0
-#define XI_DEBUG_OUTPUT 1
+#define XI_DEBUG_OUTPUT 0
 
 // On the mbed app board we can use the LCD for debug output,
 // but one may wish to modify this and write to file instead