#include <iostream>
using namespace std;

#include <stdlib.h>

#include "Cmps03.h"

int main()
{
  int i2cHandle;
  char answer;

  if((i2cHandle = open("/dev/i2c-0", O_RDWR)) < 0)
  {
    cout << "Open Failed" << endl;
    exit(1);
  }

  Cmps03 compass(i2cHandle);

  cout << "This program will call the calibration routine for the compass." << endl;
  cout << "You will be asked to position the vehicle in the four directions (North, East, South, West)." << endl;
  cout << "Do you want to continue (y, n)?" << endl;
  cin >> answer;

  if(toupper(answer) == 'Y')
    compass.calibrate();
  else
    cout << "Calibration not done." << endl;

  return 0;
}
