TOP Contributors

  1. MIKROE (2653 codes)
  2. Alcides Ramos (351 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 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 (136650 times)
  2. FAT32 Library (69863 times)
  3. Network Ethernet Library (55899 times)
  4. USB Device Library (46243 times)
  5. Network WiFi Library (41869 times)
  6. FT800 Library (41106 times)
  7. GSM click (28959 times)
  8. PID Library (26403 times)
  9. mikroSDK (26324 times)
  10. microSD click (25340 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

Gyro 4 click

Rating:

5

Author: MIKROE

Last Updated: 2019-07-31

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: Motion

Downloaded: 2720 times

Not followed.

License: MIT license  

Gyro 4 Click is a two-axis MEMS gyroscope for optical image stabilization applications. It is equipped with the L20G20IS, that includes a sensing element and an IC interface capable of providing the measured angular rate to the application through an SPI digital interface.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Gyro 4 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Gyro 4 click" changes.

Do you want to report abuse regarding "Gyro 4 click".

  • mikroSDK Library 2.0.0.0
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

Gyro 4 click

Gyro 4 click

Native view of the Gyro 4 click board.

View full image
Gyro 4 click

Gyro 4 click

Front and back view of the Gyro 4 click board.

View full image

Library Description

Library contains function for getting INT pin state Library contains function for setting CS pin state Library contains function for getting register values Library contains function for setting register values Library contains function for device initialization Library contains function for getting temperature value Library contains function for getting axes values Library contains function for software reset Library contains functions for setting power mode and full scale range

Key functions:

  • uint8_t gyro4_initialize( void ) - initializes the device.
  • uint8_t gyro4_get_temperature( float * temperature ) - gets values of temperature registers and convets those values to [deg C].
  • uint8_t gyro4_get_axes( float * x_axis, float * y_axis ) - gets values from axes registers and converts those values to [deg/s].

Examples description

The application is composed of three sections :

  • System Initialization - Initalizes GPIO pins, SPI and LOG modules
  • Application Initialization - Initializes SPI driver
  • Application Task - Checks for data ready interrupt, gets axes and temperature data and logs those values
void applicationTask( )
{
    int_flag = gyro4_intGet( );
    while (int_flag == 1)
    {
        int_flag = gyro4_intGet( );
    }
    
    gyro4_get_temperature( &die_temperature );
    gyro4_get_axes( &x_axis, &y_axis );

    mikrobus_logWrite( " ", _LOG_LINE );

    FloatToStr( die_temperature, text );
    gyro4_floatCut( );
    mikrobus_logWrite( "> Die temperature : ", _LOG_TEXT );
    mikrobus_logWrite( text, _LOG_TEXT );
    mikrobus_logWrite( degrees_celsius, _LOG_LINE );

    FloatToStr( x_axis, text );
    gyro4_floatCut( );
    mikrobus_logWrite( "> X axis : ", _LOG_TEXT );
    mikrobus_logWrite( text, _LOG_TEXT );
    mikrobus_logWrite( degrees_per_second, _LOG_LINE );

    FloatToStr( y_axis, text );
    gyro4_floatCut( );
    mikrobus_logWrite( "> Y axis : ", _LOG_TEXT );
    mikrobus_logWrite( text, _LOG_TEXT );
    mikrobus_logWrite( degrees_per_second, _LOG_LINE );

    Delay_ms(500);
}


Additional Functions :

  • gyro4_floatCut() - Rounds float number to two decimals

Other mikroE Libraries used in the example:

  • SPI
  • UART
  • Conversions

Additional notes and informations

Depending on the development board you are using, you may need USB UART clickUSB 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.

ALSO FROM THIS AUTHOR

DIGI POT 7 click

0

DIGI POT 7 Click is a compact add-on board used as a digitally controlled potentiometer. This board features the AD5175, a single-channel 1024-position digital rheostat with less than ±1% end-to-end resistor tolerance error and 50-time programmable wiper memory from Analog Devices. This I2C configurable IC is designed to operate as a variable resistor for analog signals, within the voltage range of single-supply operation at 2.7 V to 5.5 V.

[Learn More]

Vibra Sense 2 click

5

Vibra Sense 2 Click is a compact add-on board that contains a piezo sensor suitable for vibration measurements.

[Learn More]

Stepper click

5

Stepper click is a stepper motor driver board in mikroBUS form factor. It features the A3967SLBT microstepping motor driver with a built-in translator.

[Learn More]