Unable to compile SparkFun_Bio_Sensor_Hub_Library for Arduino Nano 33 BLE

Works fine when compiling for the Arduino Uno. The issue seems to be with Arduino Mbed Nano boards. I’m following the steps mentioned here

https://learn.sparkfun.com/tutorials/sp … okup-guide

I am using the example code and can’t seem to get it to compile.

Arduino: 1.8.13 (Windows 10), Board: "Arduino Nano 33 BLE"
C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp: In member function 'uint8_t SparkFun_Bio_Sensor_Hub::setPulseWidth(uint16_t)':

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:430:11: warning: unused variable 'statusByte' [-Wunused-variable]

   uint8_t statusByte;

           ^~~~~~~~~~

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp: In member function 'uint8_t SparkFun_Bio_Sensor_Hub::setSampleRate(uint16_t)':

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:479:11: warning: unused variable 'statusByte' [-Wunused-variable]

   uint8_t statusByte;

           ^~~~~~~~~~

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp: In member function 'uint8_t SparkFun_Bio_Sensor_Hub::setAdcRange(uint16_t)':

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:535:11: warning: unused variable 'statusByte' [-Wunused-variable]

   uint8_t statusByte;

           ^~~~~~~~~~

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:537:11: warning: variable 'bits' set but not used [-Wunused-but-set-variable]

   uint8_t bits;

           ^~~~

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp: In member function 'uint8_t SparkFun_Bio_Sensor_Hub::setOutputMode(uint8_t)':

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:678:18: warning: comparison is always false due to limited range of data type [-Wtype-limits]

   if (outputType < PAUSE || outputType > SENSOR_ALGO_COUNTER) // Bytes between 0x00 and 0x07

       ~~~~~~~~~~~^~~~~~~

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp: In member function 'uint8_t SparkFun_Bio_Sensor_Hub::setFifoThreshold(uint8_t)':

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:698:17: warning: comparison is always false due to limited range of data type [-Wtype-limits]

   if( intThresh < 0 || intThresh > 255)

       ~~~~~~~~~~^~~

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:698:34: warning: comparison is always false due to limited range of data type [-Wtype-limits]

   if( intThresh < 0 || intThresh > 255)

                        ~~~~~~~~~~^~~~~

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp: In member function 'uint8_t SparkFun_Bio_Sensor_Hub::setAlgoRange(uint8_t)':

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:854:12: warning: comparison is always false due to limited range of data type [-Wtype-limits]

   if( perc < 0 || perc > 100)

       ~~~~~^~~

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp: In member function 'uint8_t SparkFun_Bio_Sensor_Hub::setAlgoStepSize(uint8_t)':

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:872:12: warning: comparison is always false due to limited range of data type [-Wtype-limits]

   if( step < 0 || step > 100)

       ~~~~~^~~

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp: In member function 'uint8_t SparkFun_Bio_Sensor_Hub::setAlgoSensitivity(uint8_t)':

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:889:13: warning: comparison is always false due to limited range of data type [-Wtype-limits]

   if( sense < 0 || sense > 100 )

       ~~~~~~^~~

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp: In member function 'uint8_t SparkFun_Bio_Sensor_Hub::setAlgoSamples(uint8_t)':

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:907:11: warning: comparison is always false due to limited range of data type [-Wtype-limits]

   if( avg < 0 || avg > 255 )

       ~~~~^~~

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:907:22: warning: comparison is always false due to limited range of data type [-Wtype-limits]

   if( avg < 0 || avg > 255 )

                  ~~~~^~~~~

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp: In member function 'uint8_t SparkFun_Bio_Sensor_Hub::writeLongBytes(uint8_t, uint8_t, uint8_t, int32_t*)':

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:1252:39: error: call of overloaded 'write(int32_t)' is ambiguous

     _i2cPort->write(_writeVal[i] >> 24);

                                       ^

In file included from C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.h:4:0,

                 from C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:21:

C:\Users\anush\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\2.0.0\libraries\Wire/Wire.h:58:20: note: candidate: virtual size_t arduino::MbedI2C::write(uint8_t)

     virtual size_t write(uint8_t data);

                    ^~~~~

C:\Users\anush\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\2.0.0\libraries\Wire/Wire.h:59:20: note: candidate: virtual size_t arduino::MbedI2C::write(int)

     virtual size_t write(int data) {

                    ^~~~~

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:1253:39: error: call of overloaded 'write(int32_t)' is ambiguous

     _i2cPort->write(_writeVal[i] >> 16);

                                       ^

In file included from C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.h:4:0,

                 from C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:21:

C:\Users\anush\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\2.0.0\libraries\Wire/Wire.h:58:20: note: candidate: virtual size_t arduino::MbedI2C::write(uint8_t)

     virtual size_t write(uint8_t data);

                    ^~~~~

C:\Users\anush\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\2.0.0\libraries\Wire/Wire.h:59:20: note: candidate: virtual size_t arduino::MbedI2C::write(int)

     virtual size_t write(int data) {

                    ^~~~~

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:1254:38: error: call of overloaded 'write(int32_t)' is ambiguous

     _i2cPort->write(_writeVal[i] >> 8);

                                      ^

In file included from C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.h:4:0,

                 from C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:21:

C:\Users\anush\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\2.0.0\libraries\Wire/Wire.h:58:20: note: candidate: virtual size_t arduino::MbedI2C::write(uint8_t)

     virtual size_t write(uint8_t data);

                    ^~~~~

C:\Users\anush\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\2.0.0\libraries\Wire/Wire.h:59:20: note: candidate: virtual size_t arduino::MbedI2C::write(int)

     virtual size_t write(int data) {

                    ^~~~~

C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:1255:33: error: call of overloaded 'write(int32_t&)' is ambiguous

     _i2cPort->write(_writeVal[i]);

                                 ^

In file included from C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.h:4:0,

                 from C:\Users\anush\Documents\Arduino\libraries\SparkFun_Bio_Sensor_Hub_Library\src\SparkFun_Bio_Sensor_Hub_Library.cpp:21:

C:\Users\anush\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\2.0.0\libraries\Wire/Wire.h:58:20: note: candidate: virtual size_t arduino::MbedI2C::write(uint8_t)

     virtual size_t write(uint8_t data);

                    ^~~~~

C:\Users\anush\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\2.0.0\libraries\Wire/Wire.h:59:20: note: candidate: virtual size_t arduino::MbedI2C::write(int)

     virtual size_t write(int data) {

                    ^~~~~

exit status 1

Error compiling for board Arduino Nano 33 BLE.



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

Any suggestions on what could be causing the compile issue ?

Unfortunately the library isn’t compatible with the Nano 33. :frowning:

Is the solution to just fix the error messages? I tried that and it works. Is there any reason the library isn’t compatible with the nano 33?

error: call of overloaded 'write(int32_t)' is ambiguous 
     _i2cPort->write(_writeVal[i] >> 8);

I don’t think it has been tested on a Nano33. The warning and error messages are because of different checks of the compiler. The warnings can be ignored. ( e.g. it is useless to check an ‘uint8_t’ on a value below zero or above 255, because it can never have that value)

The error is because the compiler wants to see an ‘int’. Thus a replacement of each of those errors with some like this should solve the issue:

int c = (_writeVal[i] >> 8) & 0xff;
_i2cPort->write(c);