-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.c
More file actions
37 lines (29 loc) · 742 Bytes
/
test.c
File metadata and controls
37 lines (29 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "bno080.h"
#include "timer.h"
#define DADDR 0x4b
int main(int argc, char **argv)
{
Bno080 *imu;
if(argc < 2){
printf("Usage: %s /dev/i2c-X\n",argv[0]);
exit(EXIT_FAILURE);
}
imu = bno080_new(DADDR, argv[1]);
if(!imu){
printf("Couldn't open %s\n",argv[1]);
exit(EXIT_FAILURE);
}
printf("******Init complete**********\n");
bno080_enable_feature(imu, ROTATION_VECTOR);
double heading;
double pitch;
double roll;
while(1){
if(bno080_hpr(imu, &heading, &pitch, &roll))
printf("heading: %f pitch:%f roll: %f\n", heading, pitch, roll);
}
free(bno080_dispose(imu));
}