-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathicm20649.ino
62 lines (54 loc) · 1.65 KB
/
icm20649.ino
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <Wire.h>
#include "ICM20649.h"
ICM20649 sensor;
void setup()
{
Serial.begin(115200);
sensor.init();
// sensor.zeroCalibrate(200,10);//sample 200 times to calibrate and it will take 200*10ms
}
void loop()
{
int16_t a,b,c;
int16_t x,y,z;
int8_t testX, testY, testZ;
sensor.getXYZ(&x,&y,&z, &testX, &testY, &testZ); // x y z and test values stand for raw gyroscope values
sensor.getACC_XYZ( &a, &b, &c); // a b c stand for raw accelerometer values
/*Serial.print("\n RAW values of gyro X , Y , Z: ");
Serial.print(x);
Serial.print(" , ");
Serial.print(y);
Serial.print(" , ");
Serial.println(z);
Serial.print("\n RAW values of acc X , Y , Z: ");
Serial.print(a);
Serial.print(" , ");
Serial.print(b);
Serial.print(" , ");
Serial.println(c);*/
Serial.print("\n self test values of gyro X , Y , Z: ");
Serial.print(testX);
Serial.print(" , ");
Serial.print(testY);
Serial.print(" , ");
Serial.println(testZ);
/*float ax,ay,az; // GYRO x y z degree/sec values
float ga,gb,gc; // ACC x y z meters/ sec^2 vaLues
sensor.getAngularVelocity(&ax,&ay,&az);
Serial.print("\n GX: ");
Serial.print(ax);
Serial.print(" GY: ");
Serial.print(ay);
Serial.print(" GZ: ");
Serial.print(az);
Serial.print(" the angular velocity ");
sensor.getG_force(&ga, &gb, &gc);
Serial.print("\n AX: ");
Serial.print(ga);
Serial.print(" AY: ");
Serial.print(gb);
Serial.print(" AZ: ");
Serial.print(gc);
Serial.print(" the g force ");*/
// delay(1000);
}