

Sprintf(sensor_string_buff, "Mag (uT): ", mag_x, mag_y, mag_z) Sprintf(sensor_string_buff, "Accel (g): ", accel_x, accel_y, accel_z) Icm20948.readAccelData(&accel_x, &accel_y, &accel_z) Sprintf(sensor_string_buff, "Gyro (deg/s): ", gyro_x, gyro_y, gyro_z) Must call this often in main loop - updates the sensor values quaternion_frequency = 50 // Max frequency = 225, min frequency = 50 magnetometer_frequency = 1, // Max frequency = 70, min frequency = 1 accelerometer_frequency = 1, // Max frequency = 225, min frequency = 1 gyroscope_frequency = 1, // Max frequency = 225, min frequency = 1 enable_quaternion = true, // Enables quaternion output enable_magnetometer = true, // Enables magnetometer output

enable_accelerometer = true, // Enables accelerometer output enable_gyroscope = true, // Enables gyroscope output mode = 1, // 0 = low power mode, 1 = high performance mode spi_speed = 7000000, // SPI clock speed in Hz, max speed is 7MHz For the quaternion output that is 50Hz, for the other three it is 1Hz. The output frequency of each sensor is set to its respective minimum.
#Arduino sensors with teensy serial
The first example ReadSensorValues reads the various outputs on the ICM-20948 and writes their values to the USB serial port. Use the included example named QuaternionAnimation with that 3D app.
#Arduino sensors with teensy code
I still need to clean up the code a bit more, but this should be a good start. Right now this library only has SPI support. This FPGA is what does the onboard sensor fusion calculations to determine the quaternions. The Invensense code loads the image file icm20948_ into the FPGA located on the ICM-20948. None of the ICM-20948 Arduino libraries contained support for the DMP (Digital Motion Processor), so I sorted through the Invensense library (worst code ever written) and wrote a layer on top of that to simplify everything. Arduino library for the ICM-20948 motion tracking sensor - with DMP support
