rpicopter / MotionSensorExample

MPU6050/MPU6500/MPU9150/MPU9250 over I2c for RaspberryPi
137 stars 80 forks source link

Please help, How to do this work , and show the Output. #10

Closed Gennanio closed 5 years ago

Gennanio commented 6 years ago

i'm the beginner of linux. but i want to know how to do this work i use MPU9250

i use Raspberry pi 3 B wired mpu9250 I2C --> rpi pin 3 SDA--> rpi pin 5 Vcc --> rpi pin 1 (3.3V) GND--> rpi pin 6 (GND)

$ git clone https://github.com/rpicopter/MotionSensorExample.git

$ cd /MotionSensorExample/MotionSensor/

$ nano Makefile

CXX=g++
AR=ar
CXXFLAGS=-Wall -g -O2
CXX_OPTS=-c -DMPU9250 -DMPU_DEBUGOFF -I../libs/

SOURCES=sensor.c inv_mpu_lib/inv_mpu.c inv_mpu_lib/inv_mpu_dmp_motion_driver.c
OBJECTS=$(SOURCES:.c=.o)

LIB=libMotionSensor.a

%.o: %.c
    $(CXX) $(CXXFLAGS) $(CXX_OPTS) $< -o $@ 

$(LIB): $(OBJECTS) 
    $(AR) rcs $(LIB) $(OBJECTS) 

all: $(LIB)

clean:
    rm -rf *.o
    rm -rf inv_mpu_lib/*.o
rm -rf $(LIB)

i change directory to MotionSensorExample and make with $ cd .. $ make

the result is

make -C MotionSensor/ 
make[1]: Entering directory '/home/mecanion/Downloads/MotionSensorExample/MotionSensor'
g++ -Wall -g -O2 -c -DMPU6050 -DMPU_DEBUGOFF -I../libs/ sensor.c -o sensor.o 
g++ -Wall -g -O2 -c -DMPU6050 -DMPU_DEBUGOFF -I../libs/ inv_mpu_lib/inv_mpu.c -o inv_mpu_lib/inv_mpu.o 
inv_mpu_lib/inv_mpu.c: In function ‘uint8_t mpu_lp_motion_interrupt(uint16_t, uint8_t, uint8_t)’:
inv_mpu_lib/inv_mpu.c:2809:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (ii = 0; ii < sizeof(st.chip_cfg.cache); ii++)
                   ^
inv_mpu_lib/inv_mpu.c: In function ‘uint8_t mpu_run_self_test(int32_t*, int32_t*)’:
inv_mpu_lib/inv_mpu.c:2228:34: warning: ‘sample_rate’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  mpu_set_sample_rate(sample_rate);
                                  ^
inv_mpu_lib/inv_mpu.c: At global scope:
inv_mpu_lib/inv_mpu.c:2408:12: warning: ‘int setup_compass()’ defined but not used [-Wunused-function]
 static int setup_compass(void)
            ^
g++ -Wall -g -O2 -c -DMPU6050 -DMPU_DEBUGOFF -I../libs/ inv_mpu_lib/inv_mpu_dmp_motion_driver.c -o inv_mpu_lib/inv_mpu_dmp_motion_driver.o 
ar rcs libMotionSensor.a sensor.o inv_mpu_lib/inv_mpu.o inv_mpu_lib/inv_mpu_dmp_motion_driver.o 
make[1]: Leaving directory '/home/mecanion/Downloads/MotionSensorExample/MotionSensor'
make -C libs/I2Cdev
make[1]: Entering directory '/home/mecanion/Downloads/MotionSensorExample/libs/I2Cdev'
g++  -c I2Cdev.c -o I2Cdev.o 
ar rcs ../libI2Cdev.a I2Cdev.o
make[1]: Leaving directory '/home/mecanion/Downloads/MotionSensorExample/libs/I2Cdev'
g++  -Wall -g -O2 -o mstest \
    main.c \
    MotionSensor/libMotionSensor.a \
    libs/libI2Cdev.a

then idk how to do next ? how to read the Output and use that Roll, Pitch, Yaw? Please help. Thank you a lot.