CMPS03 Compass HelloWorld Program

Dependencies:   mbed CMPS03

This program is an example of how to use the CMPS03 compass library.

People may also use the CMPS03 I2C library that can be found in Mbed component section.

main.cpp

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

File content as of revision 1:96861dcaec35:

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

    Serial          pc          (PA_2, PA_3, 921600);

    DigitalOut      led1        (PA_5);
    DigitalOut      led2        (PD_2);
    DigitalOut      disquette   (PA_12);

    CMPS03          boussole    (PC_4);

int main()
{

    pc.printf ("\nHelloWorld\n\r");
    led1 = 1;
    led2 = 0;
    disquette = 0;
    
    while(1) {
        pc.printf("\r%5.2lf", boussole.getBearing());
        led1 = !led1;
        led2 = !led2;
        wait (0.2);
    }
}