addon

Connection to BNO055 sensor on Arduino hardware

Description

This object represents a connection to a BNO055 sensor connected to the Arduino® hardware over I2C. To get orientation, accelerometer, magnetometer, and gyroscope data, you can create connections to sensor on the shield using Object Functions.

Creation

Description

example

BNO055Sensor = addon(arduinoObj,'Adafruit\BNO055') creates an add-on connection to Adafruit® BNO055 connected to the Arduino hardware.

example

BNO055Sensor = addon(arduinoObj,'Adafruit\BNO055',Name,Value) adds additional options specified by one or more Name,Value pair arguments.

Input Arguments

expand all

Arduino hardware connection with the specified as an arduino object.

Example: BNO055Sensor = addon(arduinoObj,'Adafruit\BNO055') creates a connection to BNO055 sensor on the specified arduino object arduinoObj.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: BNO055Sensor = addon(arduinoObj,'Adafruit\BNO055','I2CAddress','0x28');

I2C address, specified as the comma-separated pair consisting of 'I2CAddress' and a hexadecimal value specified as a character vector or a string.

Example: BNO055Sensor = addon(arduinoObj,'Adafruit\BNO055','I2CAddress','0x28'); sets the I2C address to 0x28.

Data Types: double

I2C bus number, specified as a 0 or 1.

Example: BNO055Sensor = addon(arduinoObj,'Adafruit\BNO055','Bus',1); sets the I2C Bus to 1.

Data Types: double

Properties

expand all

This property is read-only.

I2C serial data pin on the Arduino hardware used by Adafruit BNO055.

Example:

>> BNO055Sensor.SDAPin
ans = 
      'A4' 

Data Types: char

This property is read-only.

I2C serial clock pin on the Arduino hardware used by Adafruit BNO055.

Example:

>> BNO055Sensor.SCLPin
ans = 
      'A5' 

Data Types: char

I2C bus number of the Adafruit BNO055, specified as 0 or 1. This property can be set during creation of the object, but it cannot be changed after.

Example:

>> BNO055Sensor.Bus
ans = 
      1 

Data Types: double

I2C device address, specified as a character vector that represents a hexadecimal value. This property can be set during creation of the object, but it cannot be changed after.

Example:

>> BNO055Sensor.I2CAddress
ans = 
      40 

Data Types: double

Object Functions

Use these object functions to create a connection to sensor on the Adafruit BNO055.

readAccelerationRead acceleration data from sensor
readAngularVelocityRead angular velocity from sensor
readCalibrationStatusRead calibration status of sensor
readMagneticFieldRead magnetic field strength at current location of sensor
readOrientationRead orientation data from sensor

Examples

collapse all

Create an arduino object.

arduinoObj = arduino("COM5","MKR1000","Libraries","Adafruit/BNO055")
Updating server code on board MKR1000 (COM5). This may take a few minutes.
arduinoObj = 
  arduino with properties:

                  Port: 'COM5'
                 Board: 'MKR1000'
         AvailablePins: {'D0-D14', 'A0-A6'}
  AvailableDigitalPins: {'D0-D14', 'A0-A6'}
      AvailablePWMPins: {'D0-D8', 'D10', 'A3-A4'}
   AvailableAnalogPins: {'A0-A6'}
    AvailableI2CBusIDs: [0]
AvailableSerialPortIDs: [1]
             Libraries: {'Adafruit/BNO055', 'I2C'}

Create a BNO055 sensor object.

BNO055Sensor = addon(arduinoObj,'Adafruit/BNO055')
BNO055Sensor = 
  BNO055 with properties:

               SCLPin: 'D12'
               SDAPin: 'D11'
                  Bus: 0
           I2CAddress: 40 ('0x28')

Create an arduino object.

arduinoObj = arduino("COM5","MKR1000","Libraries","Adafruit/BNO055")
Updating server code on board MKR1000 (COM5). This may take a few minutes.
arduinoObj = 
  arduino with properties:

                  Port: 'COM5'
                 Board: 'MKR1000'
         AvailablePins: {'D0-D14', 'A0-A6'}
  AvailableDigitalPins: {'D0-D14', 'A0-A6'}
      AvailablePWMPins: {'D0-D8', 'D10', 'A3-A4'}
   AvailableAnalogPins: {'A0-A6'}
    AvailableI2CBusIDs: [0]
AvailableSerialPortIDs: [1]
             Libraries: {'Adafruit/BNO055', 'I2C'}

Create a BNO055 sensor object with I2CAddress name value pair.

BNO055Sensor = addon(arduinoObj,'Adafruit/BNO055','I2CAddress','0x28')
BNO055Sensor = 
  BNO055 with properties:

               SCLPin: 'D12'
               SDAPin: 'D11'
                  Bus: 0
           I2CAddress: 40 ('0x28')

Introduced in R2019b