![]() Updates the requirements on [nalgebra](https://github.com/dimforge/nalgebra) to permit the latest version. - [Release notes](https://github.com/dimforge/nalgebra/releases) - [Changelog](https://github.com/dimforge/nalgebra/blob/dev/CHANGELOG.md) - [Commits](https://github.com/dimforge/nalgebra/compare/v0.24.1...v0.31.2) --- updated-dependencies: - dependency-name: nalgebra dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> |
||
---|---|---|
.cargo | ||
.circleci | ||
.github | ||
examples | ||
misc | ||
src | ||
.gitignore | ||
Cargo.toml | ||
LICENSE | ||
README.md |
mpu6050

no_std driver for the MPU6050 6-axis IMU
What Works
- Reading the accelerometer, gyroscope, temperature sensor
- raw
- scaled
- roll/pitch estimation
- Motion Detection
- Setting Accel/Gyro Ranges/Sensitivity
- Setting Accel HPF/LPF
Basic usage
To use this driver you must provide a concrete embedded_hal
implementation. Here's a
linux_embedded_hal
example
use mpu6050::*;
use linux_embedded_hal::{I2cdev, Delay};
use i2cdev::linux::LinuxI2CError;
fn main() -> Result<(), Mpu6050Error<LinuxI2CError>> {
let i2c = I2cdev::new("/dev/i2c-1")
.map_err(Mpu6050Error::I2c)?;
let mut delay = Delay;
let mut mpu = Mpu6050::new(i2c);
mpu.init(&mut delay)?;
loop {
// get roll and pitch estimate
let acc = mpu.get_acc_angles()?;
println!("r/p: {:?}", acc);
// get temp
let temp = mpu.get_temp()?;
println!("temp: {:?}c", temp);
// get gyro data, scaled with sensitivity
let gyro = mpu.get_gyro()?;
println!("gyro: {:?}", gyro);
// get accelerometer data, scaled with sensitivity
let acc = mpu.get_acc()?;
println!("acc: {:?}", acc);
}
}