2018-05-05 15:56:39 +02:00
|
|
|
/* Teste l'IMU */
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <wiringPiI2C.h>
|
|
|
|
|
|
|
|
#include "i2c.h"
|
|
|
|
#include "imu.h"
|
|
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
|
|
|
|
(void)argc;
|
|
|
|
(void)argv;
|
|
|
|
|
|
|
|
initI2C();
|
|
|
|
configureIMU();
|
|
|
|
if (!connectedIMU()) {
|
|
|
|
printf("IMU not connected\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2018-05-09 00:59:09 +02:00
|
|
|
struct axesRaw a;
|
|
|
|
struct axesRaw g;
|
2018-05-05 15:56:39 +02:00
|
|
|
for (;;) {
|
2018-05-09 00:59:09 +02:00
|
|
|
a = readAcelRaw();
|
|
|
|
printf("X:%5d Y:%5d Z:%5d\n", a.x, a.y, a.z);
|
|
|
|
g = readGyroRaw();
|
|
|
|
printf("X:%5d Y:%5d Z:%5d\n", g.x, g.y, g.z);
|
|
|
|
printf("\n");
|
2018-05-05 15:56:39 +02:00
|
|
|
usleep(100*1000);
|
|
|
|
}
|
|
|
|
|
|
|
|
exit(0);
|
|
|
|
}
|