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: 2018-12-10
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Motion
Downloaded: 4118 times
Not followed.
License: MIT license
Pedometer 3 click is a three-axis acceleration sensing Click board which utilizes the KX126-1063. An advanced tri-axis acceleration sensor, KX126-1063 includes the pedometer algorithm support.
Do you want to subscribe in order to receive notifications regarding "Pedometer 3 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Pedometer 3 click" changes.
Do you want to report abuse regarding "Pedometer 3 click".
Library Description
The library initializes and defines the I2C or SPI bus driver and drivers that offer a choice for writing data in the register and reads data from register. The library includes the function for reading Accel X/Y/Z axis data, the function for reading pedometer stem counter, the function for detect Tilt and Tap. The user also has the functions for configuration device functions for reads interrupt states.
Key functions:
void pedometer3_getAccelAxis(int16_t *x_axis, int16_t *y_axis, int16_t *z_axis)
- Functions for reading Accel axis datauint16_t pedometer3_getPedometerStepCounter()
- Functions for getting pedometer step countervoid pedometer3_getTiltPosition(uint8_t *current_pos, uint8_t *previous_pos)
- Functions for getting Tilt current and previous positionvoid pedometer3_getTapDetection(uint8_t *tap)
- Functions for getting Tap detectionExamples description
The application is composed of the three sections :
Note: The start configuration chip is required at the beginning of each program so that the chip wakes up and prepares for operation and measurement. What is included and set in the start-up function can be viewed in the help file.
void applicationTask()
{
pedometer3_getAccelAxis( &X_accelAxis, &Y_accelAxis, &Z_accelAxis );
pedometer3_getHighPassAccelAxis( &X_hpAxis, &Y_hpAxis, &Z_hpAxis );
pedStep += pedometer3_getPedometerStepCounter();
mikrobus_logWrite("|___________ Pedometer 3 click _____________|", _LOG_LINE );
mikrobus_logWrite("| Data | X axis | Y axis | Z axis |", _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_LINE);
mikrobus_logWrite("| HP Accel |", _LOG_TEXT );
IntToStr(X_hpAxis, demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" |", _LOG_TEXT);
IntToStr(Y_hpAxis, demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" |", _LOG_TEXT);
IntToStr(Z_hpAxis, demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" |", _LOG_LINE);
mikrobus_logWrite("|___________________________________________|", _LOG_LINE );
mikrobus_logWrite("| Pedometer step counter :", _LOG_TEXT );
IntToStr(pedStep, demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" |", _LOG_LINE);
mikrobus_logWrite("|___________________________________________|", _LOG_LINE );
pedometer3_getTiltPosition(&CurrentTiltPosition, &PreviousTiltPosition);
mikrobus_logWrite("| Current Tilt Position :", _LOG_TEXT );
switch(CurrentTiltPosition)
{
case 1:
{
mikrobus_logWrite("- LEFT |", _LOG_LINE );
break;
}
case 2:
{
mikrobus_logWrite("- RIGHT |", _LOG_LINE );
break;
}
case 3:
{
mikrobus_logWrite("- DOWN |", _LOG_LINE );
break;
}
case 4:
{
mikrobus_logWrite("- UP |", _LOG_LINE );
break;
}
case 5:
{
mikrobus_logWrite("- FACE DOWN |", _LOG_LINE );
break;
}
case 6:
{
mikrobus_logWrite("- FACE UP |", _LOG_LINE );
break;
}
}
mikrobus_logWrite("|___________________________________________|", _LOG_LINE );
mikrobus_logWrite(" ", _LOG_LINE);
Delay_ms( 400 );
}
Other mikroE Libraries used in the example:
I2C
Additional notes and information
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.