Dreameforce 2013 giveaway demo

Dependencies:   C12832_lcd EthernetInterface LM75B MMA7660 libxively mbed-rtos mbed

Fork of xively-dreamforce by Ilya Dmitrichenko

Revision:
15:7443df31ff5b
Parent:
14:1bb008e28de8
Child:
16:878226cefdb1
diff -r 1bb008e28de8 -r 7443df31ff5b main.cpp
--- a/main.cpp	Sat Nov 09 10:15:50 2013 +0000
+++ b/main.cpp	Mon Nov 11 17:33:56 2013 +0000
@@ -14,14 +14,20 @@
 #include "C12832_lcd.h"
 
 LM75B tmp(p28, p27);
+DigitalOut fan(p22);
 C12832_LCD lcd;
 
 #include "logo.h"
 
 int main() {
     lcd_print_xively_logo();
+    //r.period( 0.001 );
+    //g.period( 0.001 );
+    //b.period( 0.001 );
     EthernetInterface eth;
     
+    Thread _rgbpwm(rgbpwm_thread);
+    
     int s = eth.init(); //Use DHCP
     
     if( s != NULL )
@@ -79,7 +85,7 @@
         return -1;
     }
 
-    while(1) {
+    while( true ) {
       
       xi_set_value_f32( temp, tmp.read() );
         
@@ -91,23 +97,29 @@
       xi_feed_get( xi_context, &input_channels );
       printf( "   [%s]\r\n", xi_get_error_string( xi_get_last_error() ) );
       
+      lcd_printf( "led: %s\nfan: %d\n", xi_value_pointer_str( led_ctl ), xi_get_value_i32( fan_ctl ) );
+      
+      switch( xi_get_value_i32( fan_ctl ) ) {
+        case 0: fan = 0; break;
+        case 1: fan = 1; break;
+      }
       if( strcmp( xi_value_pointer_str( led_ctl ), "RED" ) == 0 )
       {
-        lcd_printf( "Turning LED red\n" );
+ 
       }
       else if( strcmp( xi_value_pointer_str( led_ctl ), "GREEN" ) == 0 )
       {
-        lcd_printf( "Turning LED green\n" );
+   
       }
       else if( strcmp( xi_value_pointer_str( led_ctl ), "BLUE" ) == 0 )
       {
-        lcd_printf( "Turning LED blue\n" );
+      
       }
       else /* OFF */
       {
-        lcd_printf( "Turning off the LED\n" );
+      
       }
       
-      wait( 15.0 );
+      wait( 5.0 );
     }
 }