1

I wanted to order the Adafruit 9-DOF Absolute Orientation IMU Fusion Breakout (here). As usual, Adafruit only gives simple Python scripts. I wanted to use this sensor from within my C++ application that I am developing. The product description contains a link to this GitHub: https://github.com/adafruit/Adafruit_BNO055. I can see that there is a header and cpp file, but the examples are all made for Arduino (.ino files).

I wanted to know if I can use this library in my C++ application running on my Raspberry Pi3b by just including the header and cpp file.

2

I wanted to know if I can use this library in my C++ application running on my Raspberry Pi3b by just including the header and cpp file.

No, not directly. Arduino's version of C++ uses a non-standard set of fundamental libraries -- notice #include "Arduino.h" and #include <Wire.h>; the latter is for i2c stuff.

WiringPi is a C library for the Pi intended to be familiar to people with previous Arduino experience. It may or may not be helpful to you in this context if you wish to use that code as a starting point.

1

I doubt this would work without rewriting a (large part of) it. You can see that this library includes "arduino.h", wich refer to a lot of arduino specific hardware implementation.

What you can do is downloading the python library : git clone https://github.com/adafruit/Adafruit_Python_BNO055.git Then rewrite in C++ by yourself the main part of it, named BN0055.py

Other way to go may be to :
1) Use a arduino as external device (i.e. via USB) and read clean values from it.
2) launch a subprocess from C++ that call a simple python script made for reading the clean value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.