Ардуино акселерометр MPU 6050 не калибруется
Ардуин акселерометр MPU 6050 не калибруется и показывает при включении сразу -7834 -4646 3046. Как исправить?
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
#include "I2Cdev.h"
#include "MPU6050.h"
/* MPU6050 default I2C address is 0x68*/
MPU6050 mpu;
int16_t ax, ay, az;
int16_t gx, gy, gz;
int x;
int y;
int z;
void setup() {
/*--Start I2C interface--*/
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
Wire.begin();
#elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
Fastwire::setup(400, true);
#endif
Serial.begin(38400); //Initializate Serial wo work well at 8MHz/16MHz
/*Initialize device and check connection*/
Serial.println("Initializing MPU...");
mpu.initialize();
Serial.println("Testing MPU6050 connection...");
if(mpu.testConnection() == false){
Serial.println("MPU6050 connection failed");
while(true);
}
else{
Serial.println("MPU6050 connection successful");
}
/* Use the code below to change accel/gyro offset values. Use MPU6050_Zero to obtain the recommended offsets */
Serial.println("Updating internal sensor offsets...\n");
mpu.setXAccelOffset(0); //Set your accelerometer offset for axis X
mpu.setYAccelOffset(0); //Set your accelerometer offset for axis Y
mpu.setZAccelOffset(0); //Set your accelerometer offset for axis Z
mpu.setXGyroOffset(0); //Set your gyro offset for axis X
mpu.setYGyroOffset(0); //Set your gyro offset for axis Y
mpu.setZGyroOffset(0); //Set your gyro offset for axis Z
Serial.print("\t");
Serial.print(mpu.getXAccelOffset());
Serial.print("\t");
Serial.print(mpu.getYAccelOffset());
Serial.print("\t");
Serial.print(mpu.getZAccelOffset());
Serial.print("\t");
Serial.print(mpu.getXGyroOffset());
Serial.print("\t");
Serial.print(mpu.getYGyroOffset());
Serial.print("\t");
Serial.print(mpu.getZGyroOffset());
Serial.print("\n");
}
void loop() {
mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
x= (ax+gx)/2;
y= (ay+gy)/2;
z= (az+gz)/2;
Serial.print(x);
Serial.print(" ");
Serial.print(y);
Serial.print(" ");
Serial.print(z);
Serial.println(" ");
delay(200);
}
Значения даже при калибровке не показывают в начале 0 везде
Я хочу создать перчатку с управлением с помощью жестов, премещения вправо влево, переворачивание.
По дате
По рейтингу
Попробую нажать на клавишу windows.
Напиши /cmd
Дальше в появившемся окне напиши format /c
Должно сработать
это тебе в программирование