返回教程正文

配套源码

sketch.ino

app/sketch/sketch.ino
ROS 2 与 App 通讯 03:发布 BNO086 IMU 数据app/sketch/sketch.ino
Arduino16 行
#include <Arduino.h>
#include <Arduino_RouterBridge.h>
#include <Bno086Imu.h>

void setup() {
  // The app owns Bridge startup; the reusable library owns IMU acquisition
  // and the two read-only RPC callbacks.
  const bool bridgeReady = Bridge.begin();
  Bno086Imu::provideRpc(bridgeReady);
  Bno086Imu::begin();
}

void loop() {
  Bno086Imu::update();
  delay(1);
}