TOP Contributors

  1. MIKROE (2784 codes)
  2. Alcides Ramos (392 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (123 codes)
  5. Bugz Bensce (97 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (140531 times)
  2. FAT32 Library (73021 times)
  3. Network Ethernet Library (58016 times)
  4. USB Device Library (48211 times)
  5. Network WiFi Library (43821 times)
  6. FT800 Library (43292 times)
  7. GSM click (30345 times)
  8. mikroSDK (28983 times)
  9. PID Library (27106 times)
  10. microSD click (26703 times)
Libstock prefers package manager

Package Manager

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]

< Back
mikroSDK Library

Inclinometer 4 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.3

mikroSDK Library: 2.0.0.0

Category: Motion

Downloaded: 64 times

Not followed.

License: MIT license  

Inclinometer 4 Click is a compact add-on board designed to measure angles of slope or elevation of an object concerning gravity's direction. This board features the FXLS8971CF, a 3-axis low-g MEMS accelerometer from NXP Semiconductor. The FXLS8971CF offers high-performance and low-power modes, with selectable full-scale ranges of ±2/4/8/16g and features such as selectable output data rates, motion detection, and a 144-byte output data buffer.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Inclinometer 4 Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Inclinometer 4 Click" changes.

Do you want to report abuse regarding "Inclinometer 4 Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


Inclinometer 4 Click

Inclinometer 4 Click is a compact add-on board designed to measure angles of slope or elevation of an object concerning gravity's direction. This board features the FXLS8971CF, a 3-axis low-g MEMS accelerometer from NXP Semiconductor. The FXLS8971CF offers high-performance and low-power modes, with selectable full-scale ranges of ±2/4/8/16g and features such as selectable output data rates, motion detection, and a 144-byte output data buffer.

inclinometer4_click.png

Click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Jun 2024.
  • Type : I2C/SPI type

Software Support

We provide a library for the Inclinometer 4 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for Inclinometer 4 Click driver.

Standard key functions :

  • inclinometer4_cfg_setup Config Object Initialization function.

    void inclinometer4_cfg_setup ( inclinometer4_cfg_t *cfg );
  • inclinometer4_init Initialization function.

    err_t inclinometer4_init ( inclinometer4_t *ctx, inclinometer4_cfg_t *cfg );
  • inclinometer4_default_cfg Click Default Configuration function.

    err_t inclinometer4_default_cfg ( inclinometer4_t *ctx );

Example key functions :

  • inclinometer4_get_int2_pin This function returns the interrupt 2 (INT2) pin logic state.

    uint8_t inclinometer4_get_int2_pin ( inclinometer4_t *ctx );
  • inclinometer4_get_data This function reads accel X, Y, and Z axis data in g and temperature in degrees Celsius.

    err_t inclinometer4_get_data ( inclinometer4_t *ctx, inclinometer4_data_t *data_out );
  • inclinometer4_set_mode This function sets the device operating mode to standby or active.

    err_t inclinometer4_set_mode ( inclinometer4_t *ctx, uint8_t mode );

Example Description

This example demonstrates the use of Inclinometer 4 Click board by reading and displaying accel data (X, Y, and Z axis) as well as temperature measurements on the USB UART.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the Click default configuration which enables data ready interrupt on INT2 pin and sets full scale range to +/-2G and output data rate to 160ms.


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    inclinometer4_cfg_t inclinometer4_cfg;  /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init " );

    // Click initialization.
    inclinometer4_cfg_setup( &inclinometer4_cfg );
    INCLINOMETER4_MAP_MIKROBUS( inclinometer4_cfg, MIKROBUS_1 );
    err_t init_flag = inclinometer4_init( &inclinometer4, &inclinometer4_cfg );
    if ( ( I2C_MASTER_ERROR == init_flag ) || ( SPI_MASTER_ERROR == init_flag ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( INCLINOMETER4_ERROR == inclinometer4_default_cfg ( &inclinometer4 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

    log_info( &logger, " Application Task " );
}

Application Task

Waits for a data ready interrupt, then reads and displays the accel data (X, Y, and Z axis) as well as temperature measurements on the USB UART.

void application_task ( void )
{
    inclinometer4_data_t accel_data;

    // Wait for a data ready interrupt
    while ( inclinometer4_get_int2_pin ( &inclinometer4 ) );

    if ( INCLINOMETER4_OK == inclinometer4_get_data ( &inclinometer4, &accel_data ) )
    {
        log_printf( &logger, " X: %.3f g\r\n", accel_data.x );
        log_printf( &logger, " Y: %.3f g\r\n", accel_data.y );
        log_printf( &logger, " Z: %.3f g\r\n", accel_data.z );
        log_printf( &logger, " Temperature: %d degC\r\n\n", ( int16_t ) accel_data.temperature );
    }
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Inclinometer4

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. UART terminal is available in all MikroElektronika compilers.


ALSO FROM THIS AUTHOR

ANNA-B412 Click

0

ANNA-B412 Click is a compact add-on board that provides BT/BLE connectivity for any embedded application. This board features the ANNA-B412, a standalone Bluetooth 5.1 low-energy module from u-blox. It is a System-in-Package (SiP) design with pre-flashed u-connectXpress software, which supports Bluetooth LE Serial port service, GATT client and server, Bluetooth beacons, Bluetooth long-range, NFC, and simultaneous peripheral and central roles. The Bluetooth module in LE mode can achieve up to 2Mbps data rates.

[Learn More]

Accel 5 click

5

Accel 5 click features an ultra-low power triaxial accelerometer sensor, labeled as the BMA400. This Click board allows linear motion and gravitational force measurements in ranges of ±2 g, ±4 g, ±8, and ±16 g in three perpendicular axes.

[Learn More]

DAC 4 click

5

DAC 4 Click carries Microchip’s MCP4728 IC, a Quad Digital-to-Analog Converter with nonvolatile (EEPROM) Memory. The digital value is converted to the appropriate voltage level in the range between GND and VCC, which is proportional to the received 12-bit number.

[Learn More]