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);
|
cz = IMU.compass_z(compassReadings);
|
||||||
|
|
||||||
|
|
||||||
// Gyrocope
|
// // Gyrocope
|
||||||
float* gyroReadings = IMU.readGyro();
|
// float* gyroReadings = IMU.readGyro();
|
||||||
gx = convertInt(IMU.gyro_x(gyroReadings), gyro_overflow_value); // gx - Pitch rate
|
// gx = convertInt(IMU.gyro_x(gyroReadings), gyro_overflow_value); // gx - Pitch rate
|
||||||
gy = convertInt(IMU.gyro_y(gyroReadings), gyro_overflow_value); // gy - Roll 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
|
// gz = convertInt(IMU.gyro_z(gyroReadings), gyro_overflow_value); // gz - Yaw rate
|
||||||
|
|
||||||
|
|
||||||
//Temperature sensor
|
// //Temperature sensor
|
||||||
gt = IMU.temp(gyroReadings);
|
// gt = IMU.temp(gyroReadings);
|
||||||
|
|
||||||
|
|
||||||
// Pitch angle from accelerometer
|
// Pitch angle from accelerometer
|
||||||
|
|
|
@ -18,8 +18,8 @@ const byte M1_A = 16;
|
||||||
const byte M1_B = 17;
|
const byte M1_B = 17;
|
||||||
const byte M2_A = 18;
|
const byte M2_A = 18;
|
||||||
const byte M2_B = 19;
|
const byte M2_B = 19;
|
||||||
const byte IMU_I2C_SCL = 26;
|
const int IMU_I2C_SCL = 26;
|
||||||
const byte IMU_I2C_SDA = 27;
|
const int IMU_I2C_SDA = 27;
|
||||||
|
|
||||||
|
|
||||||
//Time variables
|
//Time variables
|
||||||
|
@ -49,12 +49,12 @@ void setup() {
|
||||||
delay(10);
|
delay(10);
|
||||||
|
|
||||||
//Initialice I2C
|
//Initialice I2C
|
||||||
//Wire.begin(IMU_I2C_SCL, IMU_I2C_SDA);
|
Wire.setPins(IMU_I2C_SCL, IMU_I2C_SDA);
|
||||||
//delay(10);
|
//delay(10);
|
||||||
|
|
||||||
//Initialize IMU
|
//Initialize IMU
|
||||||
Serial.println("Before IMU init");
|
Serial.println("Before IMU init");
|
||||||
IMU.init(IMU_I2C_SCL, IMU_I2C_SDA);
|
IMU.init();
|
||||||
//IMU.init();
|
//IMU.init();
|
||||||
Serial.println("After IMU init");
|
Serial.println("After IMU init");
|
||||||
delay(10);
|
delay(10);
|
||||||
|
@ -95,7 +95,7 @@ void loop() {
|
||||||
|
|
||||||
|
|
||||||
//Get sensor data
|
//Get sensor data
|
||||||
//readIMU();
|
readIMU();
|
||||||
|
|
||||||
|
|
||||||
//Control motors
|
//Control motors
|
||||||
|
|
|
@ -8,8 +8,8 @@ void plot() {
|
||||||
// Serial.print(" ");
|
// Serial.print(" ");
|
||||||
|
|
||||||
// IMU
|
// IMU
|
||||||
// Serial.print ( "Pitch:" );
|
Serial.print ( "Pitch:" );
|
||||||
// Serial.println ( pitch );
|
Serial.println ( pitch );
|
||||||
// Serial.print (" ");
|
// Serial.print (" ");
|
||||||
// Serial.print ( "Accelerometer_Pitch:" );
|
// Serial.print ( "Accelerometer_Pitch:" );
|
||||||
// Serial.print ( acc_pitch );
|
// Serial.print ( acc_pitch );
|
||||||
|
|
Loading…
Reference in New Issue