Driver for MeGyro module.
More...
#include <src/MeGyro.h>
Driver for MeGyro module.
Class: MeGyro
- Description
- Declaration of Class MeGyro
- Copyright (C), 2012-2016, MakeBlock
◆ MeGyro() [1/3]
Alternate Constructor which can call your own function to map the MeCompass to arduino port, no pins are used or initialized here
Alternate Constructor which can call your own function to map the MeGyro to arduino port, no pins are used or initialized here
◆ MeGyro() [2/3]
| MeGyro::MeGyro |
( |
uint8_t |
port | ) |
|
Alternate Constructor which can call your own function to map the MeCompass to arduino port, no pins are used or initialized here, but PWM frequency set to 976 Hz
- Parameters
-
| [in] | port | - RJ25 port from PORT_1 to M2 |
Alternate Constructor which can call your own function to map the MeGyro to arduino port, no pins are used or initialized here, but PWM frequency set to 976 Hz
- Parameters
-
| [in] | port | - RJ25 port from PORT_1 to M2 |
◆ MeGyro() [3/3]
| MeGyro::MeGyro |
( |
uint8_t |
port, |
|
|
uint8_t |
address |
|
) |
| |
Alternate Constructor which can call your own function to map the MeCompass to arduino port and change the i2c device address no pins are used or initialized here, but PWM frequency set to 976 Hz
- Parameters
-
| [in] | port | - RJ25 port from PORT_1 to M2 |
| [in] | address | - the i2c address you want to set |
Alternate Constructor which can call your own function to map the MeGyro to arduino port and change the i2c device address no pins are used or initialized here, but PWM frequency set to 976 Hz
- Parameters
-
| [in] | port | - RJ25 port from PORT_1 to M2 |
| [in] | address | - the i2c address you want to set |
◆ begin()
| void MeGyro::begin |
( |
void |
| ) |
|
- Function
- begin
- Description
- Initialize the MeGyro.
- Parameters
-
- Output
- None
- Returns
- None
- Others
- You can check the MPU6050 datasheet for the registor address.
◆ fast_update()
| void MeGyro::fast_update |
( |
void |
| ) |
|
- Function
- fast_update
- Description
- Fast update some calculated angle values to the variable.
- Parameters
-
- Output
- None
- Returns
- None
- Others
- The angle values are calculated by complementary filter. The time constant of filter is set to 0.5 second, but period dt is not a constant, so the filter coefficient will be calculated dynamically.
◆ getAngle()
| double MeGyro::getAngle |
( |
uint8_t |
index | ) |
const |
- Function
- getAngle
- Description
- Get the angle value of setting axis.
- Parameters
-
| [in] | index | - Axis settings(1:X-axis, 2:Y-axis, 3:Z-axis) |
- Output
- None
- Returns
- The angle value of setting axis
- Others
- Z-axis angle value is integral of Z-axis angular velocity.
◆ getAngleX()
| double MeGyro::getAngleX |
( |
void |
| ) |
const |
- Function
- getAngleX
- Description
- Get the angle value of X-axis.
- Parameters
-
- Output
- None
- Returns
- The angle value of X-axis
- Others
- X-axis angle value is calculated by complementary filter.
- Function
- getAngleY
- Description
- Get the angle value of X-axis.
- Parameters
-
- Output
- None
- Returns
- The angle value of X-axis
- Others
- X-axis angle value is calculated by complementary filter.
◆ getAngleY()
| double MeGyro::getAngleY |
( |
void |
| ) |
const |
- Function
- getAngleY
- Description
- Get the angle value of Y-axis.
- Parameters
-
- Output
- None
- Returns
- The angle value of Y-axis
- Others
- Y-axis angle value is calculated by complementary filter.
◆ getAngleZ()
| double MeGyro::getAngleZ |
( |
void |
| ) |
const |
- Function
- getAngleZ
- Description
- Get the angle value of Z-axis.
- Parameters
-
- Output
- None
- Returns
- The angle value of Z-axis
- Others
- Z-axis angle value is integral of Z-axis angular velocity.
◆ getDevAddr()
| uint8_t MeGyro::getDevAddr |
( |
void |
| ) |
const |
- Function
- getDevAddr
- Description
- Get the device address of Gyro.
- Parameters
-
- Output
- None
- Returns
- The device address of Gyro
- Others
- None
◆ getGyroX()
| double MeGyro::getGyroX |
( |
void |
| ) |
const |
- Function
- getGyroX
- Description
- Get the data of gyroXrate.
- Parameters
-
- Output
- None
- Returns
- The data of gyroXrate
- Others
- None
◆ getGyroY()
| double MeGyro::getGyroY |
( |
void |
| ) |
const |
- Function
- getGyroY
- Description
- Get the data of gyroYrate.
- Parameters
-
- Output
- None
- Returns
- The data of gyroYrate
- Others
- None
◆ getGyroZ()
| double MeGyro::getGyroZ |
( |
void |
| ) |
const |
- Function
- getGyroZ
- Description
- Get the data of gyroZrate.
- Parameters
-
- Output
- None
- Returns
- The data of gyroZrate
- Others
- None
◆ resetData()
| void MeGyro::resetData |
( |
void |
| ) |
|
- Function
- resetData
- Description
- Reset the angle value of setting axis.
- Parameters
-
- Output
- None
- Returns
- None
- Others
- None
- Author
- Nicolas Bourré
◆ setpin()
| void MeGyro::setpin |
( |
uint8_t |
AD0, |
|
|
uint8_t |
INT |
|
) |
| |
- Function
- setpin
- Description
- Set the PIN of the button module.
- Parameters
-
| [in] | AD0 | - pin mapping for arduino |
| [in] | INT | - pin mapping for arduino |
- Output
- None
- Returns
- None.
- Others
- Set global variable _AD0, _INT, s1 and s2
◆ update()
| void MeGyro::update |
( |
void |
| ) |
|
- Function
- update
- Description
- Update some calculated angle values to the variable.
- Parameters
-
- Output
- None
- Returns
- None
- Others
- The angle values are calculated by complementary filter. The time constant of filter is set to 0.5 second, but period dt is not a constant, so the filter coefficient will be calculated dynamically.
The documentation for this class was generated from the following files: