-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGyro.h
More file actions
38 lines (35 loc) · 827 Bytes
/
Copy pathGyro.h
File metadata and controls
38 lines (35 loc) · 827 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
38
#include <Arduino.h>
#include <Wire.h>
#define FACTOR 18.0 / 256.0
#define ZDRIFT -4.92 //-5.11 //-4.73
#define YDRIFT -4.58
#define XDRIFT -14.8//-14.8
#define CTRL_REG1 0x20
#define CTRL_REG2 0x21
#define CTRL_REG3 0x22
#define CTRL_REG4 0x23
#define CTRL_REG5 0x24
#define L3G4200D_Address 105
class Gyro {
public:
Gyro();
double getZ();
double getY();
double getX();
double tuneZDrift(int i);
double tuneYDrift(int i);
double tuneXDrift(int i);
void configure();
void reset();
private:
double x, y, z, Ztime, Ytime, Xtime;
int sign;
double modAngle(double angle);
double getSeconds();
int getGyroX();
int getGyroY();
int getGyroZ();
int setupL3G4200D(int scale);
void writeRegister(int deviceAddress, byte address, byte val);
int readRegister(int deviceAddress, byte address);
};