/*
  testCompass.cpp

  Read and display value from the compass in infinite loop
*/

#include <iostream>
using namespace std;

#include <stdlib.h>

#include "Cmps03.h"

int main()
{
  int i2cHandle;

  if((i2cHandle = open("/dev/i2c-0", O_RDWR)) < 0)
  {
    cout << "Open Failed" << endl;
    exit(1);
  }

  Cmps03 compass(i2cHandle);

  float deg;

  while(1)
  {
    deg = compass.readC();
    usleep(1000);
    printf("Deg: %.1f\n", deg);
  }

  return 0;
}
