jrowberg / i2cdevlib

I2C device library collection for AVR/Arduino or other C++-based MCUs
http://www.i2cdevlib.com
3.94k stars 7.51k forks source link

No such file or directory #301

Open VitorCo opened 7 years ago

VitorCo commented 7 years ago

Hello, im traying to use a code did with arduino to control servomotors using the MPU6050 drive at MSP430 using the IDE Energia, that is similar to the IDE Arduino. It works fine with ARDUINO but when i try to test with MSP430 using Energia the code doesnt compile.

The error is: C:\Users\vitor\Downloads\Energia\energia-1.6.10E18\libraries\I2Cdev\msp430_i2c.c:14:17: fatal error: i2c.h: No such file or directory.

But i already put the libraries at the Energia libraries folder.

Im using this code:

include "Wire.h"

include "I2Cdev.h"

include "MPU6050.h"

include "Servo.h"

MPU6050 mpu;

int16_t ax, ay, az; int16_t gx, gy, gz;

Servo myservo_1; Servo myservo_2;

int val; int prevVal; int preVal_2; int val_2;

void setup() { Wire.begin(); Serial.begin(38400);

Serial.println("Initialize MPU");
mpu.initialize();
Serial.println(mpu.testConnection() ? "Connected" : "Connection failed");
myservo_1.attach(9);
myservo_2.attach(8);

}

void loop() { mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);

val = map(ay, 200, -17000, 135, 40);
val_2 = map(ay, 200, 17000, 135, 40);
if (val != prevVal)
{ 
  if(val>135){
    val = 135;
  }
    myservo_1.write(val);        
    prevVal = val;
    Serial.print(" posição Ay = "); Serial.println(ay);
}
    if (val_2 != prevVal)
{ 
  if(val_2>135){
    val_2 = 135;
  }
    myservo_2.write(val_2);        
    preVal_2 = val_2;
    Serial.print(" posição Ay = "); Serial.println(ay);
}
delay(50);

} Someone could help me?

theumairahmed commented 6 years ago

Hey @VitorCo, did you ever find a solution to this? I will be thankful to you for providing it.