mirror of
https://github.com/RobotechLille/cdf2018-principal
synced 2024-06-26 04:59:00 +02:00
38 lines
601 B
C
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);
|
|
}
|