Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: JON_IMU/IMU.h
- Revision:
- 0:0309bb86b703
diff -r 000000000000 -r 0309bb86b703 JON_IMU/IMU.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/JON_IMU/IMU.h Thu Feb 23 22:59:51 2012 +0000 @@ -0,0 +1,51 @@ +#ifndef IMU_H +#define IMU_H + +//****************************************************************************/ +// Includes +//****************************************************************************/ +#include "mbed.h" + +//****************************************************************************/ +// Defines +//****************************************************************************/ +#define Rad2Deg 57.2957795 +#define ZERO_G 1.65 + +class IMU { +public: + + IMU(PinName XGyro, PinName YAccel, PinName ZAccel, PinName AZ); + + void initialise(void); + + void update(void); + + float getRoll(void); + float getGyrox(void); + float getAccelx(void); + +private: + float X, Y, Z, Xrate, Yrate, Gyro_offset; + float GYROX_accom, GYROY_accom; + float AccAngleX, AccAngleY, AccAngleZ, GyroAngleX, GyroAngleY; + float Roll, Pitch; + Timer t; + + AnalogIn _XGyro; + AnalogIn _YAccel; + AnalogIn _ZAccel; + DigitalOut _AZ; + + float reading[100]; + float w, median ; + long middle, samples; + + void Median(void); +}; + + + + + +#endif \ No newline at end of file