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: 2019-01-08
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Motion
Downloaded: 3421 times
Not followed.
License: MIT license
The Gyro 2 click is a three-axis digital angular rate sensor which can sense the angular movement and velocity in three perpendicular axes. The Click board is equipped with the FXAS21002C, a three-axis integrated angular rate gyroscope.
Do you want to subscribe in order to receive notifications regarding "Gyro 2 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Gyro 2 click" changes.
Do you want to report abuse regarding "Gyro 2 click".
Library Description
The library provides generic functions for working with the click board.
Key functions:
uint8_t gyro2_getId()
- Function for reading the ID register of the click board.void gyro2_getAxisraw(int16_t *axisData)
- Function for reading the raw axis data from the click board.void gyro2_calcAxis(int16_t *axisData)
- Function for calculating the axis data.Examples description
The application is composed of the three sections :
void applicationTask()
{
char text[10];
int16_t axisData[3];
char state;
char temperature;
gyro2_getAxisraw(&axisData[0]);
gyro2_calcAxis(&axisData[0]);
IntToStr(axisData[0],&text[0]);
Ltrim(&text[0]);
mikrobus_logWrite("x: ",_LOG_TEXT);
mikrobus_logWrite(&text[0],_LOG_LINE);
IntToStr(axisData[1],&text[0]);
Ltrim(&text[0]);
mikrobus_logWrite("y: ",_LOG_TEXT);
mikrobus_logWrite(&text[0],_LOG_LINE);
IntToStr(axisData[2],&text[0]);
Ltrim(&text[0]);
mikrobus_logWrite("z: ",_LOG_TEXT);
mikrobus_logWrite(&text[0],_LOG_LINE);
temperature=gyro2_readTemperature();
ByteToStr(temperature,&text[0]);
Ltrim(&text[0]);
mikrobus_logWrite("Temperature: ",_LOG_TEXT);
mikrobus_logWrite(&text[0],_LOG_TEXT);
mikrobus_logWrite(" °C",_LOG_LINE);
mikrobus_logWrite("++",_LOG_LINE);
Delay_ms(200);
}
Other mikroE Libraries used in the example:
Conversions Library
C_String Library
UART Library
I2C Library
SPI Library
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.