test receiver for weather peeps

Dependencies:   LCDTFT_ssd0139 mbed

Revision:
0:d69865abf42a
Child:
1:a1c10567ccf0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jun 11 14:12:48 2015 +0000
@@ -0,0 +1,94 @@
+#include "mbed.h"
+#include "LCDTFT.h"
+
+BusOut MyBus(PTA13,PTD5,PTD4,PTA12,PTA4,PTA5,PTC8,PTC9);     // 8 bit bus on these dvices
+LCDTFT     MyLCD(PTB0,PTB1,PTB2,PTB3,PTC2,&MyBus);           //LCDTFT(PinName PIN_RD,PinName PIN_WR,PinName PIN_RS,PinName PIN_CS,PinName PIN_RESET, BusOut *BUSLCD);
+
+DigitalOut myled(LED1);
+Serial infoin(PTE0,PTE1);
+Serial pc(USBTX,USBRX);
+DigitalOut unlock(PTB8);
+DigitalIn doorOpen(PTB9);
+
+char c;
+int i;
+
+
+int flagRFID = 0;
+int flagWEATHER = 0;
+
+char message[20];
+
+
+int main() {
+     unlock =1;
+     MyLCD.vLCDTFTInit(1);
+     MyLCD.vLCDTFTFillScreen(Aqua);
+     MyLCD.vLCDTFTSetParametersPrintf(0,0,0,320,1,Black,Aqua);
+     
+    
+    while(1) {
+       
+            if(doorOpen == 1){
+                pc.printf("Door is Open");
+            }
+       
+        if(infoin.readable()) {
+            c=infoin.getc();
+            message[i] = c;
+            i++;
+            
+
+            
+            
+            if(c=='a'){
+                //if the first letter is a, we're getting an RFID
+                flagRFID = 1;
+                //MyLCD.printf("A");
+                i=0;
+            }  
+            
+            if(c=='A'){
+                //if we get a dot, we reach the end of the RFID
+                
+                for(int j =0;j<8;j++){
+                MyLCD.printf("%c",message[j]);
+                i=0;
+                             
+                
+                flagRFID = 0;
+                }
+                
+                unlock = 0;
+                wait(1);
+                unlock = 1;
+            }
+            
+                                                
+            if(c=='b'){
+                //if the first letter is b, we're getting Weather
+                flagWEATHER =1;
+                i = 0;
+            }
+            
+            if (c =='B'){
+                //if we get a B, we're at the end of Weather.
+                MyLCD.printf("moo");
+                i=0;
+                flagWEATHER = 0;
+                
+            }
+                
+  
+            //pc.putc(c);
+           // else{
+            //MyLCD.printf("%c",c);
+           // }
+            
+        
+
+        }
+       
+    
+    }
+}