Used separately, it works fine.
When I use them together....the code freezes or the board restarts... does anyone know how I can solve the problem...!!! why BNO055 messes up servo signals or why messes up I2C... Uart...!!!
Code: Select all
#include <IBusBM.h>
// ================================== IBus Servo =============================
IBusBM IBusServo;
HardwareSerial Serial_1(1);
// ================================== Compass
#include "BNO055_support.h"
#include <Wire.h>
//#define ADDRESS 0x28
struct bno055_t myBNO;
struct bno055_euler Yau;
double Compass;
unsigned long lastTime = 0;
// ================================== I2C
#define SDA_0 19 //
#define SCL_0 21 //
void setup()
{
Serial.begin(115200);
Wire.begin(SDA_0, SCL_0);
BNO_Init(&myBNO);
bno055_set_operation_mode(OPERATION_MODE_NDOF);
delay(500);
IBusServo.begin(Serial_1);
Serial_1.begin(115200, SERIAL_8N1, 4, 15);
delay(500);
}
void loop()
{
// ========================= Compas =================================
if ((millis() - lastTime) >= 100)
{
lastTime = millis();
bno055_read_euler_hrp(&Yau);
Compass = Yau.h / 16.00; //Convert to degrees
}
Serial.print(" Ch 0 = ");
Serial.print(IBusServo.readChannel(0));
Serial.print(" Compass = ");
Serial.println(Compass);
}