Gyroscope 4x

 

gyroscope is a device that measures orientation. It is very common in consumer electronics such as portable electronic devices and video game controllers to detect movement and rotation.

Output: This module outputs 0V to 5V on one of its two signal pins when its angle is changed (e.g. is moved). The value is approximately 2.5V when there is no angle change in the X or Y axis. When you connect this module to the input on an Arduino using the TinkerKit Shield, you can expect to read values between 0 to 1023 while changing the angle of the module.

Module description: on the board you’ll find a green LED that signals that the module is correctly powered. The module is based on the LPR5150AL by ST Microelectronics, and is a two-axis gyroscope. This version of the module outputs the 4X pins on the chip. For more information about this please have a look at the datasheet.

This module is a SENSOR. Each connector is an OUTPUT which must be connected to one of the INPUTconnectors on the TinkerKit Shield.

/*
Gyro
 
 Reads two analog input pins; a T000064 Gyro Module with 
 the x-axis connected to I0 pin the y-axis connected to 
 the I1 pin and prints the results to the serial monitor.
 
 created on Dec 2011
 by Federico Vanzati
 
 This example code is in the public domain.
 
 */

// include the TinkerKit library
#include <TinkerKit.h>

// creating the object ‘gyro’ that belongs to the ‘TKGyro’ class
// and giving the values to the desired input pins
// using the 4x amplified module, insert the TK_4X costant.
TKGyro gyro(I0, I1, TK_X4);  

void setup()
{
  // initialize serial communications at 9600 bps
  Serial.begin(9600);
}

void loop()
{
  Serial.print("X raw: ");
  // print x-axis analog value
  Serial.print(gyro.getXAxis());
  Serial.print("\t rate:");
  // print the x-axis anguar rate in the range of -/+1500 °/s
  Serial.print(gyro.getXAxisRate());
  Serial.print("\t|\t Y raw:");
  // print x-axis analog value
  Serial.print(gyro.getYAxis());       
  Serial.print("\t rate:");
  // print the x-axis anguar rate in the range of -/+1500 °/s
  Serial.println(gyro.getYAxisRate());  

  delay(1000);
}