2014-12-15 13:49:58 -08:00
|
|
|
/*
|
2015-02-10 11:34:28 -08:00
|
|
|
* Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
|
2014-12-15 13:49:58 -08:00
|
|
|
* Copyright (c) 2014 Intel Corporation.
|
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* This program and the accompanying materials are made available under the
|
|
|
|
* terms of the The MIT License which is available at
|
|
|
|
* https://opensource.org/licenses/MIT.
|
2014-12-15 13:49:58 -08:00
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2014-12-15 13:49:58 -08:00
|
|
|
*/
|
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2016-04-25 14:27:51 -07:00
|
|
|
#include "itg3200.hpp"
|
2017-08-30 15:00:29 -07:00
|
|
|
#include "upm_utilities.h"
|
2014-12-15 13:49:58 -08:00
|
|
|
|
|
|
|
int
|
2017-08-30 15:00:29 -07:00
|
|
|
main(int argc, char** argv)
|
2014-12-15 13:49:58 -08:00
|
|
|
{
|
2017-08-30 15:00:29 -07:00
|
|
|
//! [Interesting]
|
|
|
|
int16_t* rot;
|
|
|
|
float* ang;
|
2014-12-15 13:49:58 -08:00
|
|
|
|
|
|
|
// Note: Sensor not supported on Intel Edison with Arduino breakout
|
2017-08-30 15:00:29 -07:00
|
|
|
upm::Itg3200 gyro(0);
|
2014-12-15 13:49:58 -08:00
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
while (true) {
|
|
|
|
gyro.update(); // Update the data
|
|
|
|
rot = gyro.getRawValues(); // Read raw sensor data
|
|
|
|
ang = gyro.getRotation(); // Read rotational speed (deg/sec)
|
2014-12-15 13:49:58 -08:00
|
|
|
fprintf(stdout, "Raw: %6d %6d %6d\n", rot[0], rot[1], rot[2]);
|
|
|
|
fprintf(stdout, "AngX: %5.2f\n", ang[0]);
|
|
|
|
fprintf(stdout, "AngY: %5.2f\n", ang[1]);
|
|
|
|
fprintf(stdout, "AngZ: %5.2f\n", ang[2]);
|
2017-08-30 15:00:29 -07:00
|
|
|
fprintf(stdout, "Temp: %5.2f Raw: %6d\n", gyro.getTemperature(), gyro.getRawTemp());
|
|
|
|
upm_delay(1);
|
2014-12-15 13:49:58 -08:00
|
|
|
}
|
2017-08-30 15:00:29 -07:00
|
|
|
//! [Interesting]
|
2014-12-15 13:49:58 -08:00
|
|
|
return 0;
|
|
|
|
}
|