Error using Adarfruit BNO055 .h .cpp and Adafruit_Sensor.h

Hey!
I am trying to use Adafruit BNO055 imu sensor and sending data to my Spark core
I am following the Adafruit guide and downloading the files needed to use the sensor: https://learn.adafruit.com/adafruit-bno055-absolute-orientation-sensor/wiring-and-test
but when I just try to compile the files in my particle dev I get lots of errors, after trying to fix some of them, for example deleted the include “Wires.h” I am still having some errors without any luck of repairing them.

For example, when trying to verify the blinker app when adding the sensor.h files in the Particle build (just adding this line - ‘#include “Adafruit_Sensor_Photon/Adafruit_Sensor_Photon.h”’), I am getting this errors:

32+0 records in
32+0 records out
32 bytes (32 B) copied, 7.4688e-05 s, 428 kB/s
4+0 records in
4+0 records out
4 bytes (4 B) copied, 0.0431388 s, 0.1 kB/s
In file included from Adafruit_Sensor_Photon/Adafruit_Sensor_Photon.cpp:1:0:

				This looks like an error in Adafruit_Sensor_Photon library.
				Would you like to create an issue on GitHub to let the author know?
				
			Adafruit_Sensor_Photon/Adafruit_Sensor_Photon.h:82:5: error: 'int8_t' does not name a type
     int8_t status;
     ^
			
				This looks like an error in Adafruit_Sensor_Photon library.
				Would you like to create an issue on GitHub to let the author know?
			
			Adafruit_Sensor_Photon/Adafruit_Sensor_Photon.h:83:5: error: 'uint8_t' does not name a type
     uint8_t reserved[3];
     ^
			
				This looks like an error in Adafruit_Sensor_Photon library.
				Would you like to create an issue on GitHub to let the author know?
			
			Adafruit_Sensor_Photon/Adafruit_Sensor_Photon.h:97:5: error: 'uint32_t' does not name a type
     uint32_t rgba;         /**< 24-bit RGBA value */
     ^
			
				This looks like an error in Adafruit_Sensor_Photon library.
				Would you like to create an issue on GitHub to let the author know?
			
			Adafruit_Sensor_Photon/Adafruit_Sensor_Photon.h:104:5: error: 'int32_t' does not name a type
     int32_t version;                          /**< must be sizeof(struct sensors_event_t) */
     ^
			
				This looks like an error in Adafruit_Sensor_Photon library.
				Would you like to create an issue on GitHub to let the author know?
				
			
			Adafruit_Sensor_Photon/Adafruit_Sensor_Photon.h:105:5: error: 'int32_t' does not name a type
     int32_t sensor_id;                        /**< unique sensor identifier */
     ^
			
				This looks like an error in Adafruit_Sensor_Photon library.
				Would you like to create an issue on GitHub to let the author know?
			
			Adafruit_Sensor_Photon/Adafruit_Sensor_Photon.h:106:5: error: 'int32_t' does not name a type
     int32_t type;                             /**< sensor type */
     ^
			
				This looks like an error in Adafruit_Sensor_Photon library.
				Would you like to create an issue on GitHub to let the author know?
			
			Adafruit_Sensor_Photon/Adafruit_Sensor_Photon.h:107:5: error: 'int32_t' does not name a type
     int32_t reserved0;                        /**< reserved */
     ^

				This looks like an error in Adafruit_Sensor_Photon library.
				Would you like to create an issue on GitHub to let the author know?
			
			Adafruit_Sensor_Photon/Adafruit_Sensor_Photon.h:108:5: error: 'int32_t' does not name a type
     int32_t timestamp;                        /**< time is in milliseconds */
     ^
			
				This looks like an error in Adafruit_Sensor_Photon library.
				Would you like to create an issue on GitHub to let the author know?
			
			Adafruit_Sensor_Photon/Adafruit_Sensor_Photon.h:132:5: error: 'int32_t' does not name a type
     int32_t  version;                         /**< version of the hardware + driver */
     ^
			
				This looks like an error in Adafruit_Sensor_Photon library.
				Would you like to create an issue on GitHub to let the author know?
			
			Adafruit_Sensor_Photon/Adafruit_Sensor_Photon.h:133:5: error: 'int32_t' does not name a type
     int32_t  sensor_id;                       /**< unique sensor identifier */
     ^
			
				This looks like an error in Adafruit_Sensor_Photon library.
				Would you like to create an issue on GitHub to let the author know?
				
			
			Adafruit_Sensor_Photon/Adafruit_Sensor_Photon.h:134:5: error: 'int32_t' does not name a type
     int32_t  type;                            /**< this sensor's type (ex. SENSOR_TYPE_LIGHT) */
     ^
			
				This looks like an error in Adafruit_Sensor_Photon library.
				Would you like to create an issue on GitHub to let the author know?
			
			Adafruit_Sensor_Photon/Adafruit_Sensor_Photon.h:138:5: error: 'int32_t' does not name a type
     int32_t  min_delay;                       /**< min delay in microseconds between events. zero = not a constant rate */
     ^
				This looks like an error in Adafruit_Sensor_Photon library.
				Would you like to create an issue on GitHub to let the author know?
			
			Adafruit_Sensor_Photon/Adafruit_Sensor_Photon.cpp:3:35: error: no 'void Adafruit_Sensor::constructor()' member function declared in class 'Adafruit_Sensor'
 void Adafruit_Sensor::constructor() {
                                   ^
		make[2]: *** [../build/target/user/platform-0-lAdafruit_Sensor_Photon/Adafruit_Sensor_Photon.o] Error 1
make[1]: *** [user] Error 2
make: *** [main] Error 2

Have you read any thread about porting Arduino libraries to Particle?

A crucial point is #include "Particle.h" (previously #include "application.h")

https://community.particle.io/search?q=arduino%20porting

1 Like

Adding the include “particle .h” solved many errors, but now I got some new errors.
In the Adafruit_BNO555.cpp file, this lines are shown multiple times:

Wire.beginTransmission(_address); #if ARDUINO >= 100 Wire.write((uint8_t)reg); #else Wire.send(reg); #endif Wire.endTransmission(); Wire.requestFrom(_address, (byte)len);

The error is: Class TwoWire has no memeber send
I tried searching on the forum for solving this import problem with no luck

Thanks for the help

If you change that to

  #if (ARDUINO >= 100) || defined(SPARK)
    Wire.write((uint8_t)reg);
  #else
    Wire.send(reg);
  #endif

it should work, since there is only Wire.write() and no Wire.send().

2 Likes