XBee to LCD

Dependencies:   TextLCD mbed

Fork of XBEE_LCD by toshio masuda

Files at this revision

API Documentation at this revision

Comitter:
MasudaToshio
Date:
Thu May 23 11:06:47 2013 +0000
Parent:
0:48b9e99fafc8
Commit message:
XBee LCD

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu May 23 10:06:07 2013 +0000
+++ b/main.cpp	Thu May 23 11:06:47 2013 +0000
@@ -1,26 +1,26 @@
 #include "mbed.h"
 #include "TextLCD.h"
 
-AnalogIn CDS(p16);
+Serial xbee(p13, p14); // tx, rx
 TextLCD lcd(p24, p26, p27, p28, p29, p30);
 
 /////////////////////////////////////////////////////
 //      main
 /////////////////////////////////////////////////////
 int main(void) {
-        float a_in , t_cds ;
-    lcd.cls();
+        char pc_in[32] ;
+    lcd.cls() ;
+    lcd.printf( "wait xbee input" ) ;
 
     while(1) {
-        a_in = ( CDS );
-        
-        t_cds = (  2.7 * exp( a_in )  + ( -2.55 )  )  ;
-        t_cds = pow( 10 , t_cds ) ;
-
-        lcd.locate(0,0);
-        lcd.printf("%3.0F lx  %5.3F V", t_cds, a_in);
-        wait(.5);
+        if(xbee.readable()) {
+            pc_in[0] = xbee.getc() ;
+            if( pc_in[0] == 0x063 ){
+                lcd.cls();
+            }else{
+                lcd.printf( pc_in );
+            }
+        }
     }
-
     return 0;
-}
\ No newline at end of file
+}