![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
slave
Dependencies: mbed
Fork of ESE350-Whack-a-Mole by
Diff: WhackAMole.cpp
- Revision:
- 3:77c9b15d79c0
- Parent:
- 1:59384b12aa98
--- 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); } }