Skip to content

MikroElektronika/Gyro_2_click

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MikroE


Gyro2 Click

  • CIC Prefix : GYRO2
  • Author : Dusan Poluga
  • Verison : 1.0.0
  • Date : okt 2018.

Software Support

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

Library Description

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 three sections :

  • System Initialization - Initialize the GPIO and communication structures.
  • Application Initialization - Initialize the communication interface and configure the click board.
  • Application Task - Read the x,y,z and temperature data from the click board and display the resoults on the serial port.
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);
}

The full application code, and ready to use projects can be found on our LibStock page.

Other mikroE Libraries used in the example:

  • Conversions Library
  • C_String Library
  • UART Library
  • I2C Library
  • SPI Library

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.