Go Down

Topic: I2C Code will compile for Mega but not Nano BLE  (Read 391 times) previous topic - next topic

cswoods6

I have been using Jeff Rowberg's i2cdevlib and a multiplexer to communicate to my 4 MPU 6050s. This is the library. https://github.com/jrowberg/i2cdevlib/tree/master/Arduino
I have been able to use it quite well with my Mega 2560, but am wanting to move to the Nano 33 BLE for the bluetooth. I first started by hooking up the BLE and trying to compile my code I used for the Mega and it will not compile. It gives me errors regarding the libraries I am using that things were not declared in the scope.
The following are my error messages.

sketch\MPU6050.cpp: In member function 'int8_t MPU6050::GetCurrentFIFOPacket(uint8_t*, uint8_t)':
MPU6050.cpp:2763: error: 'BUFFER_LENGTH' was not declared in this scope
                  uint8_t Trash[BUFFER_LENGTH];
                                ^~~~~~~~~~~~~
MPU6050.cpp:2769: error: 'Trash' was not declared in this scope
                          getFIFOBytes(Trash, (uint8_t)RemoveBytes);
                                       ^~~~~
sketch\MPU6050.cpp: In member function 'void MPU6050::PrintActiveOffsets()':
MPU6050.cpp:3349: error: 'dtostrf' was not declared in this scope
 #define printfloatx(Name,Variable,Spaces,Precision,EndTxt) { Serial.print(F(Name)); {char S[(Spaces + Precision + 3)];Serial.print(F(" ")); Serial.print(dtostrf((float)Variable,Spaces,Precision ,S));}Serial.print(F(EndTxt)); }//Name,Variable,Spaces,Precision,EndTxt
                                                                                                                                                          ^
sketch\MPU6050.cpp:3349:154: note: in definition of macro 'printfloatx'
 #define printfloatx(Name,Variable,Spaces,Precision,EndTxt) { Serial.print(F(Name)); {char S[(Spaces + Precision + 3)];Serial.print(F(" ")); Serial.print(dtostrf((float)Variable,Spaces,Precision ,S));}Serial.print(F(EndTxt)); }//Name,Variable,Spaces,Precision,EndTxt
                                                                                                                                                          ^~~~~~~
sketch\MPU6050.cpp:3349:154: note: suggested alternative: 'strstr'

 #define printfloatx(Name,Variable,Spaces,Precision,EndTxt) { Serial.print(F(Name)); {char S[(Spaces + Precision + 3)];Serial.print(F(" ")); Serial.print(dtostrf((float)Variable,Spaces,Precision ,S));}Serial.print(F(EndTxt)); }//Name,Variable,Spaces,Precision,EndTxt
                                                                                                                                                          ^
sketch\MPU6050.cpp:3349:154: note: in definition of macro 'printfloatx'
 #define printfloatx(Name,Variable,Spaces,Precision,EndTxt) { Serial.print(F(Name)); {char S[(Spaces + Precision + 3)];Serial.print(F(" ")); Serial.print(dtostrf((float)Variable,Spaces,Precision ,S));}Serial.print(F(EndTxt)); }//Name,Variable,Spaces,Precision,EndTxt
                                                                                                                                                          ^~~~~~~
exit status 1
'BUFFER_LENGTH' was not declared in this scope

Any help would be appreciated.

windoze_killa

Did you select Nano BLE in the tools/Board pull down menu?
Engineers design things.....technicians make them work.

I don't need anti-static wrist straps.....an instructor years ago told me I had no potential.

Go Up