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-11-24
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Magnetic
Downloaded: 2320 times
Not followed.
License: MIT license
Compass 5 Click is a compact add-on board that contains a 3-axis magnetometer device suitable for compass application. This board features the AK09918C, a 3-axis electronic compass with high sensitive Hall sensor technology from AKM Semiconductor.
Do you want to subscribe in order to receive notifications regarding "Compass 5 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Compass 5 click" changes.
Do you want to report abuse regarding "Compass 5 click".
Library Description
The library contains a basic functions for using Compass 5 Click.
Key functions:
void compass5_get_id ( uint8_t *company_id, uint8_t *device_id );
- Function for get ID.uint8_t compass5_set_operation_mode ( uint8_t op_mode );
- Function for set operation mode.void compass5_get_mag_data ( int16_t *axis_x, int16_t *axis_y, int16_t *axis_z );
- Full measurement axis.Examples description
The application is composed of three sections :
void application_task ( )
{
int16_t x_val;
int16_t y_val;
int16_t z_val;
if ( compass5_check_data_ready( ) == COMPASS5_DATA_READY )
{
compass5_measurement_axis( &x_val, &y_val, &z_val );
Delay_ms( 10 );
FloatToStr( x_val, log_txt );
mikrobus_logWrite( " X-axis: ", _LOG_TEXT );
mikrobus_logWrite( log_txt, _LOG_TEXT );
mikrobus_logWrite( "mG", _LOG_LINE );
FloatToStr( y_val, log_txt );
mikrobus_logWrite( " Y-axis: ", _LOG_TEXT );
mikrobus_logWrite( log_txt, _LOG_TEXT );
mikrobus_logWrite( "mG", _LOG_LINE );
FloatToStr( z_val, log_txt );
mikrobus_logWrite( " Z-axis: ", _LOG_TEXT );
mikrobus_logWrite( log_txt, _LOG_TEXT );
mikrobus_logWrite( "mG", _LOG_LINE );
mikrobus_logWrite( "--------------------", _LOG_LINE );
}
Delay_ms( 2000 );
}
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.