QC Control software

Dependencies:   mbed

Fork of dgps by Colin Stearns

handle/handleCompass.cpp

Committer:
krobertson
Date:
2014-04-26
Revision:
49:06721139d298
Parent:
44:2ae602b89961
Child:
66:5d43988d100c

File content as of revision 49:06721139d298:

#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);
}