38#define SPI_FAST_SPEED 1000000
58 Serial.println(
"ERROR: beginSPI() failed");
63 Serial.println(F(
"ERROR: setSensors failed"));
67 Serial.println(F(
"Mag init failed"));
69 Serial.println(F(
"Mag initialized"));
71 Serial.println(
"Ready.");
85 Serial.print(F(
"ACC [g]: "));
86 Serial.print(ax, 3); Serial.print(
", ");
87 Serial.print(ay, 3); Serial.print(
", ");
88 Serial.println(az, 3);
90 Serial.println(F(
"ACC read failed"));
95 Serial.print(F(
"GYR [dps]: "));
96 Serial.print(gx, 2); Serial.print(
", ");
97 Serial.print(gy, 2); Serial.print(
", ");
98 Serial.println(gz, 2);
100 Serial.println(F(
"GYR read failed"));
105 Serial.print(F(
"MAG [uT]: "));
106 Serial.print(mx, 2); Serial.print(
", ");
107 Serial.print(my, 2); Serial.print(
", ");
108 Serial.println(mz, 2);
110 Serial.println(F(
"MAG read failed"));
115 Serial.print(F(
"TMP [C]: "));
116 Serial.println(tC, 2);
118 Serial.println(F(
"TMP read failed"));
121 Serial.println(F(
"-----------------------------"));
bool readGyro(float &x, float &y, float &z)
bool readAccel(float &x, float &y, float &z)
bool beginSPI(uint8_t csPin, SPIClass &spiPort=SPI, uint32_t spiSpeed=1000000)
bool readMag(float &x, float &y, float &z)
bool readTemperature(float &temperature)
bool setSensors(bool accel_on, bool gyro_on, bool temp_on)
void setup()
Initialize Serial and start the ICM-20948 over SPI.
SPIClass spi_bus(SPI)
SPI bus object used by the IMU driver.
#define SPI_FAST_SPEED
SPI clock used during sensor initialization and reads.
DevLab_ICM20948 imu
Global ICM-20948 driver instance.
#define CS_PIN
Chip-select pin for SPI.
void loop()
Read and print accelerometer, gyroscope, and temperature data.