IntroRoboticsLab2/gyro.ino.ino

31 lines
597 B
C++

#include "MeMCore.h"
#include <Wire.h>
MeGyro gyro(PORT_4);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
gyro.begin();
}
void loop() {
// put your main code here, to run repeatedly:
gyro.update();
Serial.read();
Serial.print("X: ");
Serial.print(gyro.getAngleX() );
Serial.print("Y: ");
Serial.print(gyro.getAngleY() );
Serial.print("Z: ");
Serial.println(gyro.getAngleZ() );
Serial.print(gyro.getAngleX());
Serial.print(",");
Serial.print(gyro.getAngleY());
Serial.print(",");
Serial.println(gyro.getAngleZ());
delay(5);
}