We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2019-02-11
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Motion
Downloaded: 4242 times
Not followed.
License: MIT license
Accel 8 click is an advanced 6-axis motion tracking Click boardâ„¢, which utilizes the MPU6050, a very popular motion sensor IC, equipped with a 3-axis gyroscope and 3-axis accelerometer.
Do you want to subscribe in order to receive notifications regarding "Accel 8 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Accel 8 click" changes.
Do you want to report abuse regarding "Accel 8 click".
Library Description
The library initializes and defines the I2C bus driver and drivers that offer a choice for writing data in register and reads data form register. The library includes function for read Accel X/Y/Z axis data, Gyro X/Y/Z axis data and device Temperature data. The user also has the function for configuration Accel and Gyro and function for read interrupt state.
Key functions:
void accel8_getAccelAxis(int16_t *x_axis, int16_t *y_axis, int16_t *z_axis)
- Functions for read Accel axis data.void accel8_getGyroAxis(int16_t *x_axis, int16_t *y_axis, int16_t *z_axis)
- Functions for read Gyro axis data.float accel8_getTemperature()
- Functions for read Temperature data in C.Examples description
The application is composed of the three sections :
void applicationTask()
{
accel8_getAccelAxis(&X_accelAxis, &Y_accelAxis, &Z_accelAxis);
accel8_getGyroAxis(&X_gyroAxis, &Y_gyroAxis, &Z_gyroAxis);
Temperature = accel8_getTemperature();
// LOGS DATA
mikrobus_logWrite("________________ Accel 8 click _________________", _LOG_LINE);
mikrobus_logWrite("| Data | X axis | Y axis | Z axis | Range |", _LOG_LINE);
mikrobus_logWrite("|_________|________|________|________|_________|", _LOG_LINE);
mikrobus_logWrite("| Accel |", _LOG_TEXT);
IntToStr(X_accelAxis, demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" |", _LOG_TEXT);
IntToStr(Y_accelAxis, demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" |", _LOG_TEXT);
IntToStr(Z_accelAxis, demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" |", _LOG_TEXT);
IntToStr(accelRange, demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" g |", _LOG_LINE);
mikrobus_logWrite("|_________|________|________|________|_________|", _LOG_LINE);
mikrobus_logWrite("| Gyro |", _LOG_TEXT);
IntToStr(X_gyroAxis, demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" |", _LOG_TEXT);
IntToStr(Y_gyroAxis, demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" |", _LOG_TEXT);
IntToStr(Z_gyroAxis, demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" |", _LOG_TEXT);
IntToStr(gyroRange, demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite("dps|", _LOG_LINE);
mikrobus_logWrite("|_________|________|________|________|_________|", _LOG_LINE);
FloatToStr(Temperature, demoText);
demoText[ 5 ] = 0;
mikrobus_logWrite("| Temp |", _LOG_TEXT);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" C |", _LOG_LINE);
mikrobus_logWrite("|_________|_________________|", _LOG_LINE);
mikrobus_logWrite(" ", _LOG_LINE);
Delay_ms( 2000 );
}
Other mikroE Libraries used in the example:
I2C
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 clickor RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.