FRC - Hackathon / Mbed 2 deprecated TestBoussole

Dependencies:   mbed CMPS03

Files at this revision

API Documentation at this revision

Comitter:
haarkon
Date:
Fri Jun 01 07:06:28 2018 +0000
Parent:
1:96861dcaec35
Commit message:
Added comment

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Jun 01 06:57:41 2018 +0000
+++ b/main.cpp	Fri Jun 01 07:06:28 2018 +0000
@@ -1,26 +1,26 @@
 #include "mbed.h"
 #include "CMPS03.h"
 
-    Serial          pc          (PA_2, PA_3, 921600);
+    Serial          pc          (PA_2, PA_3, 921600);   //Create a serial link to PC
 
-    DigitalOut      led1        (PA_5);
-    DigitalOut      led2        (PD_2);
-    DigitalOut      disquette   (PA_12);
+    DigitalOut      led1        (PA_5);                 // Added Led1 for test purpose
+    DigitalOut      led2        (PD_2);                 // Added Led2 for test purpose
+    DigitalOut      disquette   (PA_12);                // Added baloon destructor command (without it, you might see baloon destructor motor be set to full speed)
 
-    CMPS03          boussole    (PC_4);
+    CMPS03          boussole    (PC_4);                 // Added compass
 
 int main()
 {
 
-    pc.printf ("\nHelloWorld\n\r");
-    led1 = 1;
-    led2 = 0;
-    disquette = 0;
+    pc.printf ("\nHelloWorld\n\r");                     // Welcome message
+    led1 = 1;                                           // Led1 is ON
+    led2 = 0;                                           // Led2 is OFF
+    disquette = 0;                                      // Switch baloon destructor to OFF
     
     while(1) {
-        pc.printf("\r%5.2lf", boussole.getBearing());
-        led1 = !led1;
-        led2 = !led2;
-        wait (0.2);
+        pc.printf("\r%5.2lf", boussole.getBearing());   // Get bearing informations
+        led1 = !led1;                                   // Switch Led1
+        led2 = !led2;                                   // Switch Led2
+        wait (0.2);                                     // Wait for 200ms
     }
 }