Coordinator v2

Dependencies:   NerfUSXbee PinDetect EthernetInterface JSON MFRC522 WebSocketClient mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
Ismael Balafrej
Date:
Tue Apr 11 15:53:20 2017 -0400
Parent:
2:019d8848cf7e
Commit message:
Final version... ?

Changed in this revision

includes/Rfid.hpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
src/GameCoordinator.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 019d8848cf7e -r 501120a68c11 includes/Rfid.hpp
--- a/includes/Rfid.hpp	Tue Apr 11 12:40:05 2017 -0400
+++ b/includes/Rfid.hpp	Tue Apr 11 15:53:20 2017 -0400
@@ -24,7 +24,7 @@
                 {                   
                     for (uint8_t i = 0; i < RfChip.uid.size; i++)
                     {
-                        itoa(RfChip.uid.uidByte[i], &(event.data.rfid_code[i]), 10);
+                        itoa(RfChip.uid.uidByte[i], &(event.data.rfid_code[i]), 16);
                     }
                     event.data.rfid_code[RfChip.uid.size] = '\0';
                     //toPc("RFID received, sending event name: %s, size: %i", event.event, RfChip.uid.size);
diff -r 019d8848cf7e -r 501120a68c11 main.cpp
--- a/main.cpp	Tue Apr 11 12:40:05 2017 -0400
+++ b/main.cpp	Tue Apr 11 15:53:20 2017 -0400
@@ -24,15 +24,15 @@
     RealXbeeReceiver xbeeReceiver;
     xbeeReceiver.start(&dispatch_event_from_target);
 
-    // //Btn interupts
+    //Btn interupts
     BtnHandler startBtn(p21, "start");
     BtnHandler nextBtn(p22, "navigate", "next");
     BtnHandler previousBtn(p23, "navigate", "previous");
 
     //Creating the targets with their 64 bits address
-    //Bruno/Max Router
-    gameCoordinator.targets.push_back(Target(0x0013A200, 0x4086DA0E, 0));
-    gameCoordinator.targets.push_back(Target(0x0013A200, 0x4086DA0E, 1));
+    //Bruno/Max Router - Brisé
+    // gameCoordinator.targets.push_back(Target(0x0013A200, 0x4086DA0E, 0));
+    // gameCoordinator.targets.push_back(Target(0x0013A200, 0x4086DA0E, 1));
 
     //Routeur antenne
     gameCoordinator.targets.push_back(Target(0x0013A200, 0x408B419E, 0));
@@ -42,7 +42,6 @@
     gameCoordinator.targets.push_back(Target(0x0013A200, 0x4033198C, 1));
 
     gameCoordinator.on_game_finish = &websocket_message_send;
-    //TODO: more targets
 
     Rfid rfid(p5, p6, p7, p28, p27);
 
diff -r 019d8848cf7e -r 501120a68c11 src/GameCoordinator.cpp
--- a/src/GameCoordinator.cpp	Tue Apr 11 12:40:05 2017 -0400
+++ b/src/GameCoordinator.cpp	Tue Apr 11 15:53:20 2017 -0400
@@ -67,7 +67,7 @@
         else
         {
             //TODO: how to select enemy or ally ? rand() % 2
-            nextTarget->rise(0, target_timeout);
+            nextTarget->rise(rand() % 2, target_timeout);
         }
         Thread::yield();
     }