Makeblock-library-for-Arduino  V3.2.4
It's a library for arduino application developers
Public Member Functions | List of all members
MeGyro Class Reference

Driver for MeGyro module. More...

#include <MeGyro.h>

Inheritance diagram for MeGyro:
MePort

Public Member Functions

 MeGyro (void)
 
 MeGyro (uint8_t port)
 
 MeGyro (uint8_t port, uint8_t address)
 
void setpin (uint8_t AD0, uint8_t INT)
 
void begin ()
 
void update (void)
 
void fast_update (void)
 
uint8_t getDevAddr (void)
 
double getAngleX (void)
 
double getAngleY (void)
 
double getAngleZ (void)
 
double getGyroX (void)
 
double getGyroY (void)
 
double getAngle (uint8_t index)
 
- Public Member Functions inherited from MePort
 MePort (void)
 
 MePort (uint8_t port)
 
 MePort (uint8_t port, uint8_t slot)
 
uint8_t getPort (void)
 
uint8_t getSlot (void)
 
bool dRead1 (uint8_t mode=INPUT)
 
bool dRead2 (uint8_t mode=INPUT)
 
bool dpRead1 (void)
 
bool dpRead2 (void)
 
void dWrite1 (bool value)
 
void dWrite2 (bool value)
 
int16_t aRead1 (void)
 
int16_t aRead2 (void)
 
void aWrite1 (int16_t value)
 
void aWrite2 (int16_t value)
 
void reset (uint8_t port)
 
void reset (uint8_t port, uint8_t slot)
 
uint8_t pin1 (void)
 
uint8_t pin2 (void)
 
uint8_t pin (void)
 
uint8_t pin (uint8_t port, uint8_t slot)
 

Additional Inherited Members

- Protected Attributes inherited from MePort
uint8_t s1
 
uint8_t s2
 
uint8_t _port
 
uint8_t _slot
 

Detailed Description

Driver for MeGyro module.

Class: MeGyro

Description
Declaration of Class MeGyro
Copyright (C), 2012-2016, MakeBlock

Constructor & Destructor Documentation

MeGyro::MeGyro ( void  )

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::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::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

Member Function Documentation

void MeGyro::begin ( void  )
Function
begin
Description
Initialize the MeGyro.
Parameters
[in]None
Output
None
Returns
None
Others
You can check the MPU6050 datasheet for the registor address.
void MeGyro::fast_update ( void  )
Function
fast_update
Description
Fast update some calculated angle values to the variable.
Parameters
[in]None
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.
double MeGyro::getAngle ( uint8_t  index)
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.
double MeGyro::getAngleX ( void  )
Function
getAngleX
Description
Get the angle value of X-axis.
Parameters
[in]None
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
[in]None
Output
None
Returns
The angle value of X-axis
Others
X-axis angle value is calculated by complementary filter.
double MeGyro::getAngleY ( void  )
Function
getAngleY
Description
Get the angle value of Y-axis.
Parameters
[in]None
Output
None
Returns
The angle value of Y-axis
Others
Y-axis angle value is calculated by complementary filter.
double MeGyro::getAngleZ ( void  )
Function
getAngleZ
Description
Get the angle value of Z-axis.
Parameters
[in]None
Output
None
Returns
The angle value of Z-axis
Others
Z-axis angle value is integral of Z-axis angular velocity.
uint8_t MeGyro::getDevAddr ( void  )
Function
getDevAddr
Description
Get the device address of Gyro.
Parameters
[in]None
Output
None
Returns
The device address of Gyro
Others
None
double MeGyro::getGyroX ( void  )
Function
getGyroX
Description
Get the data of gyroXrate.
Parameters
[in]None
Output
None
Returns
The data of gyroXrate
Others
None
double MeGyro::getGyroY ( void  )
Function
getGyroY
Description
Get the data of gyroYrate.
Parameters
[in]None
Output
None
Returns
The data of gyroYrate
Others
None
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
void MeGyro::update ( void  )
Function
update
Description
Update some calculated angle values to the variable.
Parameters
[in]None
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: