football_project_wo_output

Dependencies:   mbed

Fork of football_project by MZJ

Revision:
95:3cc3ae2e5e7f
Parent:
94:831a7fc2d69a
Child:
97:2894fbc2d4f8
--- a/main.cpp	Thu Jun 16 03:55:32 2016 +0000
+++ b/main.cpp	Thu Jun 16 05:06:24 2016 +0000
@@ -1,6 +1,5 @@
 #include <RFM69.h>
 #include <list>
-#include "output.h"
 #include <DebounceIn.h>
 #ifdef BLE_ENABLE
   #include "ble/BLE.h"
@@ -10,7 +9,7 @@
 using namespace std;
 
 Timer tmr;
-Output out;
+//Output out;
 
 #ifdef BLE_ENABLE
 BLEDevice  ble;
@@ -278,16 +277,18 @@
         //   - beep if the user is too close to another one
         int i=0, nContacts, signal, maxTeamSignal = -128;
         list<Player>::iterator it;
-        out.clear();
+        //out.clear();
         for (it=players.begin(); it != players.end(); ++it) {
             signal = it->get_distance(nContacts);
             if(signal>-128) {
+                /*
                 out.printf("%d ", ++i);
                 out.printf((team==it->team) ? "+" : "-");       // teammate or opponent?
                 out.printf("%s ", it->name);
                 out.printf("%d/%d", -signal, nContacts);
                 out.printf((-signal<SPACE[level]) ? "!" : " ");
                 out.printf("\r\n");
+                */
             }
             if(team==it->team && signal>maxTeamSignal) {
                 maxTeamSignal = signal;
@@ -393,7 +394,7 @@
     
     // Pick node number
     char this_node = int(ain.read()*255+17)*int(ain.read()*255+11); // random node value
-    out.printf("Node: %d\r\n", this_node);
+    //out.printf("Node: %d\r\n", this_node);
 
     // Initialize the radio    
     radio.initialize(FREQUENCY, this_node, NETWORKID);
@@ -409,8 +410,10 @@
 
     // Pick node name
     generate_name(rand_name, sizeof(rand_name));
+    /*
     out.printf("Name: %s\r\n", rand_name);
     out.sleep(2.0);
+    */
         
     tmr.start();
     
@@ -429,9 +432,11 @@
             myTeam = (myTeam==1) ? 2 : 1;
             ledTeamA = myTeam & 1;
             ledTeamB = ~myTeam & 1;
+            /*
             out.clear();
             out.printf("New team: %d\r\n", myTeam);
             out.sleep(2);
+            */
         }
         bTeamOld = bTeamNew;
         
@@ -440,9 +445,11 @@
         if(bSpaceNew && !bSpaceOld) {
             level = (level+1) & 0b11;   // four states
             spaceLEDs(level);
+            /*
             out.clear();
             out.printf("New level: %d\r\n", level);
             out.sleep(2);
+            */
         }
         bSpaceOld = bSpaceNew;
 
@@ -453,16 +460,20 @@
             volume++;
             if(volume>3) volume=3;
             ledBuzzer = 1;
+            /*
             out.clear();
             out.printf("New volume: %d\r\n", volume);
             out.sleep(2);
+            */
         }
         if(bVLNew && !bVLOld) {
             if(volume>0) volume--;
             if(!volume) ledBuzzer = 0;
+            /*
             out.clear();
             out.printf("New volume: %d\r\n", volume);
             out.sleep(2);
+            */
         }
         bVMOld = bVMNew;
         bVLOld = bVLNew;
@@ -518,10 +529,12 @@
                 //beep(NOTE_A5, 0.5, volume);
             } else {    // received unknown signal 
                 uint8_t gain = (radio.readReg(REG_LNA) & 0b111000)>>3;   // LNA Current Gain
+                /*
                 out.clear();
                 out.printf("Got: %s\r\n", rx_buff);
                 out.printf("RSSI: %d, G: %d\r\n", radio.RSSI, gain);
                 out.sleep(2.0);
+                */
             }
         }