FRC - Hackathon / Mbed 2 deprecated TestBoussole

Dependencies:   mbed CMPS03

main.cpp

Committer:
haarkon
Date:
2018-06-01
Revision:
2:4dae0a194d00
Parent:
1:96861dcaec35

File content as of revision 2:4dae0a194d00:

#include "mbed.h"
#include "CMPS03.h"

    Serial          pc          (PA_2, PA_3, 921600);   //Create a serial link to PC

    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);                 // Added compass

int main()
{

    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());   // Get bearing informations
        led1 = !led1;                                   // Switch Led1
        led2 = !led2;                                   // Switch Led2
        wait (0.2);                                     // Wait for 200ms
    }
}