From 80864c4f1428af53b039b007de3808787ddcf520 Mon Sep 17 00:00:00 2001 From: "mattis.roellinger" Date: Mon, 11 Mar 2024 10:09:43 +0100 Subject: [PATCH] Added the gyro file with the code that gives the 3 angles of rotation x,y,z. --- gyro/gyro.ino | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 gyro/gyro.ino diff --git a/gyro/gyro.ino b/gyro/gyro.ino new file mode 100644 index 0000000..5ed0a64 --- /dev/null +++ b/gyro/gyro.ino @@ -0,0 +1,44 @@ +/** + * \par Copyright (C), 2012-2016, MakeBlock + * @file GyroRotation.ino + * @author MakeBlock + * @version V1.0.0 + * @date 2015/09/09 + * @brief Description: this file is sample code for MeGyro device. + * + * Function List: + * 1. void MeGyro::begin(void) + * 2. void MeGyro::update(void) + * 3. double MeGyro::angleX(void) + * 4. double MeGyro::angleY(void) + * 5. double MeGyro::angleZ(void) + * + * \par History: + *
+ *      
+ * + */ +#include "MeOrion.h" +#include + +MeGyro gyro; +void setup() +{ + Serial.begin(115200); + gyro.begin(); +} + +void loop() +{ + 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() ); + delay(200); +}