DevLab_ICM20948 1.0.2
ICM-20948 9-Axis Motion Sensor Driver
Loading...
Searching...
No Matches
i2c_magneto.ino File Reference
#include <Wire.h>
#include <DevLab_ICM20948.h>

Go to the source code of this file.

Macros

#define SDA_PIN   6
 I2C SDA pin used by the example board.
 
#define SCL_PIN   7
 I2C SCL pin used by the example board.
 
#define I2C_FREQ   400000UL
 I2C bus speed in hertz.
 
#define ICM_ADDR   0x69
 ICM-20948 I2C address selected by the AD0 pin.
 

Functions

void setup ()
 Configure I2C, verify the IMU, and initialize the magnetometer.
 
void loop ()
 Read and print magnetometer data in microtesla.
 

Variables

DevLab_ICM20948 imu
 Global ICM-20948 driver instance.
 

Macro Definition Documentation

◆ I2C_FREQ

#define I2C_FREQ   400000UL

I2C bus speed in hertz.

Definition at line 43 of file i2c_magneto.ino.

◆ ICM_ADDR

#define ICM_ADDR   0x69

ICM-20948 I2C address selected by the AD0 pin.

Definition at line 45 of file i2c_magneto.ino.

◆ SCL_PIN

#define SCL_PIN   7

I2C SCL pin used by the example board.

Definition at line 41 of file i2c_magneto.ino.

◆ SDA_PIN

#define SDA_PIN   6

I2C SDA pin used by the example board.

Definition at line 39 of file i2c_magneto.ino.

Function Documentation

◆ loop()

void loop ( )

Read and print magnetometer data in microtesla.

Definition at line 98 of file i2c_magneto.ino.

Here is the call graph for this function:

◆ setup()

void setup ( )

Configure I2C, verify the IMU, and initialize the magnetometer.

The magnetometer is accessed through the ICM-20948 internal I2C master, so initMag() must succeed before loop() can read magnetic field data.

Definition at line 56 of file i2c_magneto.ino.

Here is the call graph for this function:

Variable Documentation

◆ imu

Global ICM-20948 driver instance.

Definition at line 48 of file i2c_magneto.ino.