1
0
Fork 0
mirror of https://github.com/RobotechLille/cdf2018-principal synced 2024-06-26 04:59:00 +02:00
cdf2018-principal/chef/src/testIMU.c
2018-05-05 15:56:39 +02:00

38 lines
601 B
C

/* 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);
}
struct gyroRaw a;
struct gyroRaw t;
for (;;) {
a = readGyroRaw();
t.x += a.x;
t.y += a.y;
t.z += a.z;
usleep(100*1000);
printf("X:%5d Y:%5d Z:%5d\n", t.x, t.y, t.z);
}
exit(0);
}