Hello.
ESP32 DevKit v1 board.
I'm trying to combine the IBusServo example from the IBusBM library, with the Bno055 compass.
Separately each one runs ok, adding Compass ... randomly blocks IBusServo or restart board.
How do you think it can be solved...!
If I solve this problem I will add IBusSensor.
#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(9600);
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) //To stream at 10Hz without using additional timers
{
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);
}