Use a gyro/accelerometer with Arduino
Hi guys, I am working on the project Accelerometer. I used= Arduino IDE 1.5 and GY 521 accelometer. But library does not see the MP 6050. I got the address library https://github.com/jrowberg/i2cdevlib/tree/master/Arduino.
And I received Error: "sketch_dec09a.ino:3: fatal error: MPU6050.h: No such file or directory compilation terminated."
Me code;
> #include <Servo.h> > #include <Wire.h> > #include <I2Cdev.h> > #include <MPU6050.h> > > MPU6050 mpu; > > int16_t ax, ay, az; int16_t gx, gy, > gz; > > Servo myservoY; Servo myservoX; > > int valY; int prevValY; > > int valX; int prevValX; > > void setup() { Wire.begin(); > Serial.begin(38400); > Serial.println("Initialize MPU"); > mpu.initialize(); > Serial.println(mpu.testConnection() ? > "Connected" : "Connection failed"); > myservoY.attach(9); > myservoX.attach(10); } void loop() { > mpu.getMotion6(&ax, &ay, &az, &gx, > &gy, &gz); valY = map(ay, -17000, > 17000, 0, 179); valX = map(ax, > -17000, 17000, 0, 179); if (valY != prevValY) { > myservoY.write(valY); > prevValY = valY; } > > if (valX != prevValX) { > myservoX.write(valX); > prevValX = valX; } delay(50); }
Asked by Hakan Bey on 2015-12-09 03:28:05 UTC
Comments
This question is not related with ROS. It is an Arduino topic. Therefore please ask this question on Arduino related boards (like https://forum.arduino.cc/). If you think that it is related with ROS please clearify.
Asked by Akif on 2015-12-09 05:02:55 UTC
Akif Meraba, sordum oraya da net bir cevap gelmedi buraya yönlendirdi bi iki arakdaşda ondan dolayı sordum.
Asked by Hakan Bey on 2015-12-09 06:47:19 UTC