Example Code for Arduino-Z-axis Rotation Rate Reading

Hardware Preparation

  • Gyro Break Board-ADXRS610 x1
  • straight header x1

Wiring Diagram

Sample Code

int z;

void setup()
{
  Serial.begin(9600);           // sets the serial port to 9600
}

void loop()
{
  z = analogRead(0);       // read analog input pin 0
  Serial.print("rotation rate in z: ");
  Serial.println(z, DEC);  // print the rotation rate in the Z axis
  delay(100);              // wait 100ms for next reading
}

Was this article helpful?

TOP