unfinished
Dependents: WRS_mechanamu_test WRS2019_master mbed_2018 mbed_2019_rx3 ... more
Diff: JY901.h
- Revision:
- 5:a492cfb18242
- Parent:
- 4:cd62e2d69f62
- Child:
- 6:7e7dd6184774
--- a/JY901.h Thu Aug 23 05:33:30 2018 +0000 +++ b/JY901.h Wed Nov 14 02:14:58 2018 +0000 @@ -23,9 +23,9 @@ **********************************************/ #define IICADDR 0xa0 // IIC address -#define g 9.8 // Acceleration of gravity +#define g 9.80665 // Acceleration of gravity -#define SAVE 0x00 // Save +//#define SAVE 0x00 // Save #define CALSW 0x01 // Calibration #define RSW 0x02 // Return data content #define RATE 0x03 // Return data Speed @@ -96,6 +96,14 @@ { public: JY901(I2C *i2c); + JY901(I2C *i2c, Timer *t); + + /****************************************/ + //not recommended + //used onle me + float calculateAngleOnlyGyro(); + void reset(); + /****************************************/ void calibrateGyroAccel(); void calibrateMagnetic(); @@ -139,8 +147,14 @@ private: char *getdata(char registar); + float s16(int dataL, int dataH); + + float last_time, time, dt; + float gyroZ[3]; + float angleZ; I2C *_i2c; + Timer *_timer; }; #endif \ No newline at end of file