Andriy Makukha / Mbed 2 deprecated football_project_wo_output

Dependencies:   mbed

Fork of football_project by MZJ

Revision:
19:afcbb425b3cf
Parent:
18:affef3a7db2a
Child:
23:26f27c462976
diff -r affef3a7db2a -r afcbb425b3cf proto_code.cpp
--- a/proto_code.cpp	Sun Nov 29 13:52:53 2015 +0000
+++ b/proto_code.cpp	Tue Dec 01 16:03:15 2015 +0000
@@ -558,7 +558,7 @@
     break;
   case 's':
     station = value;
-    writeToPhone("Selected station %d", value);
+    writeToPhone("Selected station %d\r\n", value);
     break;
   case 'd':
     if(value == 0){
@@ -583,18 +583,20 @@
     break;
   case 't':
     t = (uint16_t)value;
-    writeToPhone("Station %d split time is: %d.", station, t/1000);
     remainder = t%1000;
-    if(remainder < 100)writeToPhone("0");
-    if(remainder < 10)writeToPhone("0");
-    writeToPhone("%d seconds.\r\n",remainder);
+    writeToPhone("Station %d split time is: %d.%03d seconds.\r\n", station, t/1000, remainder);
+///    if(remainder < 100)writeToPhone("0");
+///    if(remainder < 10)writeToPhone("0");
+///    writeToPhone("%d seconds.\r\n",remainder);
     if(station <= STATIONS && station > 0)times[station-1] = t;
     break;
   case 'l':
     l = 0;
     l = (uint8_t)value;
     masks[station-1] = l;
-    writeToPhone("Station %d config bits: %d\r\n", station, l);
+    writeToPhone( "Station %d config bits: ", station );
+    writeBitsToPhone( l );
+    writeToPhone( "\r\n" );
     break;
   case 'q':
     state_p = IDLE_P;
@@ -604,11 +606,11 @@
     break;
   case 'r':
     //Serial.println(F(""));
-    writeToPhone("Current pattern is %d:", active_sequence+1);
+    writeToPhone("Current pattern is %d:\r\n", active_sequence+1);
     for(int i=0; i<STATIONS; i++){
       writeToPhone("Station %d: cone %d, ", i+1, cones[i]);
       split = times[i];
-      //printMsAsSeconds(split);
+      printMsAsSeconds(split);
       //Serial.print(F("s timeout, lights: "));
       writeToPhone("s timeout, config bits: ");
       l = masks[i];
@@ -628,7 +630,8 @@
       if(l<0b10)
         writeToPhone("0");
         */
-      writeToPhone("%d\r\n", l);
+      writeBitsToPhone( l, 3 );
+      writeToPhone( "\r\n" );
       //Serial.println(l, BIN);
     }
     break;
@@ -909,8 +912,9 @@
   
   //DEBUG("%d",number/1000);
   //DEBUG(".");
-  
+
   remainder = number%1000;
+
   /*
   if(remainder < 100)
     //DEBUG("0");
@@ -920,6 +924,8 @@
     
   //DEBUG("%d",remainder);
   */
+
+  writeToPhone( "%d.%03d", number/1000, remainder );
 }
 
  void spinButtons(void)