Compiling error of Grove - IMU 9DOF v2.0 example

hi when I interface my Grove - IMU 9DOF v2.0 sensor with LoRa WAN board after uploading the library when I run example code of that I found this error can any one help me with that?

Arduino: 1.8.12 (Windows Store 1.8.33.0) (Windows 10), Board: “Seeeduino LoRaWAN, Arduino, Off”

In file included from C:\Users\Reday\Documents\Arduino\libraries\Grove_IMU_9DOF_9250\I2Cdev.h:74:0,

             from C:\Users\Reday\Documents\Arduino\libraries\Grove_IMU_9DOF_9250\I2Cdev.cpp:44:

C:\Users\Reday\Documents\Arduino\libraries\Grove_IMU_9DOF_9250\I2Cdev.cpp: In static member function ‘static int8_t I2Cdev::readBytes(uint8_t, uint8_t, uint8_t, uint8_t*, uint16_t)’:

C:\Users\Reday\Documents\Arduino\libraries\Grove_IMU_9DOF_9250\I2Cdev.cpp:276:62: error: ‘BUFFER_LENGTH’ was not declared in this scope

         for (uint8_t k = 0; k < length; k += min(length, BUFFER_LENGTH)) {



                                                          ^

C:\Users\Reday\Documents\ArduinoData\packages\Seeeduino\hardware\samd\1.7.2\cores\arduino/Arduino.h:103:24: note: in definition of macro ‘min’

#define min(a,b) ((a)<(b)?(a):(b))

                    ^

C:\Users\Reday\Documents\Arduino\libraries\Grove_IMU_9DOF_9250\I2Cdev.cpp: In static member function ‘static int8_t I2Cdev::readWords(uint8_t, uint8_t, uint8_t, uint16_t*, uint16_t)’:

C:\Users\Reday\Documents\Arduino\libraries\Grove_IMU_9DOF_9250\I2Cdev.cpp:416:70: error: ‘BUFFER_LENGTH’ was not declared in this scope

         for (uint8_t k = 0; k < length * 2; k += min(length * 2, BUFFER_LENGTH)) {



                                                                  ^

C:\Users\Reday\Documents\ArduinoData\packages\Seeeduino\hardware\samd\1.7.2\cores\arduino/Arduino.h:103:24: note: in definition of macro ‘min’

#define min(a,b) ((a)<(b)?(a):(b))

                    ^

exit status 1
Error compiling for board Seeeduino LoRaWAN.

This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.

@rhreday
I’m really sorry that our documentation was incorrect and caused you trouble. This software library should be used. I have also updated the documentation, thanks for the feedback .

1 Like

hi thanks for your fix. but after uploading code serial monitor does not show anything. can you help me with that please?

@jiachenglu Please help answer the customer’s questions

hi,@rhreday please change all of the 'Serial‘ in the code to ‘SerialUSB’,and download again.

I checked all serial monitor baud but nothing comes up. even I changed I2Cdev files’ Serial into SerialUSB nothing changed

btw I noticed after running this code TX light does not glow. RX light glow when I upload this code

Hi @rhreday I am really sorry that I make a mistake.You do not need change Serial into SerialUSB .Please add a line code in the sample code like this picture, then you follow the step in the wiki you can see samething in the serial monitor.Our engineer will update the documentation in recent days, then you just need to download the latest documentation again, no need to add code.

thanks.
Its working but when I run It showed MPU6050 connection failed and show every thing as 0. which is a error

Hi @rhreday
Did you connect the Grove-IMU 9DOF to Seeeduino LoRaWAN directly,or use wrong i2c interface at the base shield ? You should connect the Grove-IMU 9DOF to the base shield with right i2c interface.

I choose Lora wan board from board manager. can you help me how to connect the Grove-IMU 9DOF to the base shield with right i2c interface with that?

I tried both I2C port… same result
image

Hi
You need a Grove base shield. Hardware connect picture like this.

If you connect the Grove-IMU 9DOF to Seeeduino LoRaWAN directly, you need to change the some code
about the I2C interface.

can you plz help me to change the code. cause I have to connect this directly with the board

Hi
Please add two line code after Serial.begin(38400); You can refer to this picture.

. After doing this, you can connect this sensor directly with the board.

1 Like

thanks its working. but how can I find that reading are correct? how to find static z axis value?

You can compare a standard product or data. @rhreday

thanks guys that was so helpful.