slave

Dependencies:   mbed

Fork of ESE350-Whack-a-Mole by Eric Berdinis

Files at this revision

API Documentation at this revision

Comitter:
shibulal
Date:
Wed Oct 21 01:30:55 2015 +0000
Parent:
1:59384b12aa98
Commit message:
slave

Changed in this revision

WhackAMole.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 59384b12aa98 -r 77c9b15d79c0 WhackAMole.cpp
--- a/WhackAMole.cpp	Tue Oct 20 18:09:41 2015 +0000
+++ b/WhackAMole.cpp	Wed Oct 21 01:30:55 2015 +0000
@@ -80,7 +80,7 @@
 //***************** You can start coding here *****************//
 int main (void)
 {
-    uint8_t channel = 2;
+    uint8_t channel = 5;
 
     //Set the Channel. 0 is default, 15 is max
     mrf.SetChannel(channel);
@@ -93,15 +93,20 @@
         
         while(true){
             rxLen = rf_receive(rxBuffer, 128); 
-            pc.printf("Received: %s\r\n", rxBuffer);    
-            if(strcmp("activate_1", txBuffer)) {
+            if (rxLen>0){
+                pc.printf("Received: %s\r\n", rxBuffer);   
+                //strcpy(rxBuffer,"");
+                if(!strcmp("activate_1", rxBuffer)) {
                 break;
                 }
+            } 
+
             }
         led1=1;
-        while (light_sensor*100>10);
+        while (light_sensor*100>10.0);
         led1=0;
         strcpy(txBuffer, "finished_1");
-        rf_send(txBuffer, strlen(txBuffer));
+        rf_send(txBuffer, strlen(txBuffer)+1);
+        pc.printf("Sent: %s\r\n", txBuffer);
     }
 }