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: 2020-10-07
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Measurements
Downloaded: 2061 times
Not followed.
License: MIT license
Compass 4 Click is an expansion board that can measure the three-axis magnetic field which is perfect for implementation in applications such as electric compasses. This board features AK09915, a complete 3-axis magnetic sensor with signal processing from AKM.
Do you want to subscribe in order to receive notifications regarding "Compass 4 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Compass 4 click" changes.
Do you want to report abuse regarding "Compass 4 click".
Library Description
The library contains a basic functions for using Compass 4 click.
Key functions:
void compass4_configuration ( uint8_t cfg1, uint8_t cfg2 )
- Configuration functionuint8_t compass4_get_axis ( compass4_axis_t *axis )
- Gets XYZ Axis valueuint8_t compass4_get_magnetic_flux ( compass4_flux_t *flux )
- Gets magnetic flux of XYZ axis valueExamples description
The application is composed of three sections :
void application_task ( )
{
compass4_flux_t flux;
char demo_text[ 20 ];
uint8_t err;
err = compass4_get_magnetic_flux( &flux );
if ( err != 0 )
{
mikrobus_logWrite( ">> Measurement error ", _LOG_LINE );
}
else
{
mikrobus_logWrite( ">> Magnetic flux data <<", _LOG_LINE );
FloatToStr( flux.x, demo_text );
mikrobus_logWrite( ">> X: ", _LOG_TEXT );
mikrobus_logWrite( demo_text, _LOG_LINE );
FloatToStr( flux.y, demo_text );
mikrobus_logWrite( ">> Y: ", _LOG_TEXT );
mikrobus_logWrite( demo_text, _LOG_LINE );
FloatToStr( flux.z, demo_text );
mikrobus_logWrite( ">> Z: ", _LOG_TEXT );
mikrobus_logWrite( demo_text, _LOG_LINE );
}
mikrobus_logWrite( ">>____________________<<", _LOG_LINE );
Delay_ms( 1000 );
}
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.