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-06-07
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Motion
Downloaded: 3678 times
Not followed.
License: MIT license
Accel 12 click is an advanced 3-axis motion tracking Click board, which utilizes the MC3216, a low-noise, and low power 3-axis accelerometer.
Do you want to subscribe in order to receive notifications regarding "Accel 12 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Accel 12 click" changes.
Do you want to report abuse regarding "Accel 12 click".
Library Description
The library initializes and defines the I2C bus driver and drivers that offer a choice for writing data in register. The library includes function for read X/Y/Z axis data and function for Tap detection interrupt. The user also has the function for configuration register and function for read interrupt state.
Key functions:
void accel12_getAxisData(int16_t *x_axis, int16_t *y_axis, int16_t *z_axis)
- Accel axis data.uint8_t accel12_getTapDetection()
- Tap detection.void accel12_configuration(uint8_t reg, uint8_t dataIn)
- Functions for configuration register.Examples description
The application is composed of three sections :
void applicationTask()
{
/* Accelerometer measurement */
accel12_getAxisData(&X_Axis, &Y_Axis, &Z_Axis);
IntToStr(X_axis, demoText);
mikrobus_logWrite(" X axis : ", _LOG_TEXT);
mikrobus_logWrite(demoText, _LOG_LINE);
IntToStr(Y_axis, demoText);
mikrobus_logWrite(" Y axis : ", _LOG_TEXT);
mikrobus_logWrite(demoText, _LOG_LINE);
IntToStr(Z_axis, demoText);
mikrobus_logWrite(" Z axis : ", _LOG_TEXT);
mikrobus_logWrite(demoText, _LOG_LINE);
/* TAP interrupt */
tap = accel12_getTapDetection();
switch(tap)
{
case 1:
{
mikrobus_logWrite(" X Positive ", _LOG_LINE);
break;
}
case 2:
{
mikrobus_logWrite(" Y Positive ", _LOG_LINE);
break;
}
case 3:
{
mikrobus_logWrite(" Z Positive ", _LOG_LINE);
break;
}
case 4:
{
mikrobus_logWrite(" X Negative ", _LOG_LINE);
break;
}
case 5:
{
mikrobus_logWrite(" Y Negative ", _LOG_LINE);
break;
}
case 6:
{
mikrobus_logWrite(" Z Negative ", _LOG_LINE);
break;
}
}
mikrobus_logWrite("---------------------", _LOG_LINE);
Delay_ms( 1500 );
}
Other mikroE Libraries used in the example:
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or 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.