this is not working
This commit is contained in:
parent
72716f2abd
commit
42034ab9e8
14
Main/IMU.ino
14
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 );
|
||||
|
|
Loading…
Reference in New Issue