41#define I2C_FREQ 400000UL
57 Serial.println(F(
"ICM-20948 (I2C) — Accel Example"));
61 Serial.println(F(
"ERROR: ICM-20948 beginI2C() failed."));
65 Serial.println(F(
"ICM-20948 ready."));
70 Serial.print(
"WHO_AM_I: 0x");
71 Serial.println(who, HEX);
80 Serial.println(F(
"setSensors failed."));
92 Serial.println(F(
"setAccelScale failed."));
99 Serial.println(F(
"setAccelDLPF failed."));
104 Serial.println(F(
"setAccelAveraging failed."));
113 Serial.println(F(
"setAccelSampleRate failed."));
130 Serial.print(
"ACCEL [g]: ");
135 Serial.println(az, 3);
137 Serial.println(F(
"ACCEL read failed"));
140 Serial.println(F(
"-----------------------------"));
bool setAccelScale(ICM20948_Accel_FullScale fullScale)
bool readAccel(float &x, float &y, float &z)
bool setAccelAveraging(ICM20948_Accel_Average avg)
bool readWhoAmI(uint8_t &whoAmI)
bool beginI2C(uint8_t address=0x69, TwoWire &i2cPort=Wire, uint32_t i2cSpeed=400000)
bool setAccelDLPF(uint8_t dlpf, bool bypass)
bool setSensors(bool accel_on, bool gyro_on, bool temp_on)
bool setAccelSampleRate(uint16_t sampleRate)
#define SCL_PIN
I2C SCL pin used by the example board.
void setup()
Configure the IMU for accelerometer-only operation over I2C.
#define SDA_PIN
I2C SDA pin used by the example board.
#define ICM_ADDR
ICM-20948 I2C address selected by the AD0 pin.
DevLab_ICM20948 imu
Global ICM-20948 driver instance.
void loop()
Read and print accelerometer data in g.