From 42034ab9e80e97d6d3bdeda9bbc373d0fce37445 Mon Sep 17 00:00:00 2001 From: Stedd Date: Thu, 19 Oct 2023 20:43:01 +0200 Subject: [PATCH] this is not working --- Main/IMU.ino | 14 +++++++------- Main/Main.ino | 10 +++++----- Main/plot.ino | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Main/IMU.ino b/Main/IMU.ino index e75255d..475b5e8 100644 --- a/Main/IMU.ino +++ b/Main/IMU.ino @@ -31,15 +31,15 @@ void readIMU() { cz = IMU.compass_z(compassReadings); - // Gyrocope - float* gyroReadings = IMU.readGyro(); - gx = convertInt(IMU.gyro_x(gyroReadings), gyro_overflow_value); // gx - Pitch rate - gy = convertInt(IMU.gyro_y(gyroReadings), gyro_overflow_value); // gy - Roll rate - gz = convertInt(IMU.gyro_z(gyroReadings), gyro_overflow_value); // gz - Yaw rate + // // Gyrocope + // float* gyroReadings = IMU.readGyro(); + // gx = convertInt(IMU.gyro_x(gyroReadings), gyro_overflow_value); // gx - Pitch rate + // gy = convertInt(IMU.gyro_y(gyroReadings), gyro_overflow_value); // gy - Roll rate + // gz = convertInt(IMU.gyro_z(gyroReadings), gyro_overflow_value); // gz - Yaw rate - //Temperature sensor - gt = IMU.temp(gyroReadings); + // //Temperature sensor + // gt = IMU.temp(gyroReadings); // Pitch angle from accelerometer diff --git a/Main/Main.ino b/Main/Main.ino index adb3cef..66637f6 100644 --- a/Main/Main.ino +++ b/Main/Main.ino @@ -18,8 +18,8 @@ const byte M1_A = 16; const byte M1_B = 17; const byte M2_A = 18; const byte M2_B = 19; -const byte IMU_I2C_SCL = 26; -const byte IMU_I2C_SDA = 27; +const int IMU_I2C_SCL = 26; +const int IMU_I2C_SDA = 27; //Time variables @@ -49,12 +49,12 @@ void setup() { delay(10); //Initialice I2C - //Wire.begin(IMU_I2C_SCL, IMU_I2C_SDA); + Wire.setPins(IMU_I2C_SCL, IMU_I2C_SDA); //delay(10); //Initialize IMU Serial.println("Before IMU init"); - IMU.init(IMU_I2C_SCL, IMU_I2C_SDA); + IMU.init(); //IMU.init(); Serial.println("After IMU init"); delay(10); @@ -95,7 +95,7 @@ void loop() { //Get sensor data - //readIMU(); + readIMU(); //Control motors diff --git a/Main/plot.ino b/Main/plot.ino index 7a9c157..64664cf 100644 --- a/Main/plot.ino +++ b/Main/plot.ino @@ -8,8 +8,8 @@ void plot() { // Serial.print(" "); // IMU - // Serial.print ( "Pitch:" ); - // Serial.println ( pitch ); + Serial.print ( "Pitch:" ); + Serial.println ( pitch ); // Serial.print (" "); // Serial.print ( "Accelerometer_Pitch:" ); // Serial.print ( acc_pitch );