QC Control software

Dependencies:   mbed

Fork of dgps by Colin Stearns

handle/handleCompass.cpp

Committer:
krobertson
Date:
2014-04-23
Revision:
44:2ae602b89961
Parent:
10:c4745ddaaf6a
Child:
49:06721139d298

File content as of revision 44:2ae602b89961:

#include "handleCompass.h"

compassHandle* compassHandle::hand = NULL;

compassHandle::compassHandle(){
    heading = 0;
    initialized = false;
}

void compassHandle::setup(){
    initialized = true;
    compass.init();
    compass.enableDefault();
}

void compassHandle::run(){
    if(!initialized){
        setup();
    }
    compass.read();
    heading = compass.get_heading();
    USB::getSerial().printf("Compass heading: %f\r\n",heading);
}