Update example with non owning delay [skip ci]
This commit is contained in:
parent
04057f3e2d
commit
25a0b45b46
1 changed files with 12 additions and 12 deletions
24
README.md
24
README.md
|
@ -16,10 +16,10 @@ fn main() -> Result<(), Mpu6050Error<LinuxI2CError>> {
|
|||
let i2c = I2cdev::new("/dev/i2c-1")
|
||||
.map_err(Mpu6050Error::I2c)?;
|
||||
|
||||
let delay = Delay;
|
||||
|
||||
let mut mpu = Mpu6050::new(i2c, delay);
|
||||
mpu.init()?;
|
||||
let mut delay = Delay;
|
||||
let mut mpu = Mpu6050::new(i2c);
|
||||
|
||||
mpu.init(&mut delay)?;
|
||||
mpu.soft_calib(Steps(100))?;
|
||||
mpu.calc_variance(Steps(50))?;
|
||||
|
||||
|
@ -29,35 +29,35 @@ fn main() -> Result<(), Mpu6050Error<LinuxI2CError>> {
|
|||
loop {
|
||||
// get roll and pitch estimate
|
||||
let acc = mpu.get_acc_angles()?;
|
||||
println!("r/p: {}", acc);
|
||||
println!("r/p: {:?}", acc);
|
||||
|
||||
// get roll and pitch estimate - averaged accross n readings (steps)
|
||||
let acc = mpu.get_acc_angles_avg(Steps(5))?;
|
||||
println!("r/p avg: {}", acc);
|
||||
println!("r/p avg: {:?}", acc);
|
||||
|
||||
// get temp
|
||||
let temp = mpu.get_temp()?;
|
||||
println!("temp: {}c", temp);
|
||||
println!("temp: {:?}c", temp);
|
||||
|
||||
// get temp - averages across n readings (steps)
|
||||
let temp = mpu.get_temp_avg(Steps(5))?;
|
||||
println!("temp avg: {}c", temp);
|
||||
println!("temp avg: {:?}c", temp);
|
||||
|
||||
// get gyro data, scaled with sensitivity
|
||||
let gyro = mpu.get_gyro()?;
|
||||
println!("gyro: {}", gyro);
|
||||
println!("gyro: {:?}", gyro);
|
||||
|
||||
// get gyro data, scaled with sensitivity - averaged across n readings (steps)
|
||||
let gyro = mpu.get_gyro_avg(Steps(5))?;
|
||||
println!("gyro avg: {}", gyro);
|
||||
println!("gyro avg: {:?}", gyro);
|
||||
|
||||
// get accelerometer data, scaled with sensitivity
|
||||
let acc = mpu.get_acc()?;
|
||||
println!("acc: {}", acc);
|
||||
println!("acc: {:?}", acc);
|
||||
|
||||
// get accelerometer data, scaled with sensitivity - averages across n readings (steps)
|
||||
let acc = mpu.get_acc_avg(Steps(5))?;
|
||||
println!("acc avg: {}", acc);
|
||||
println!("acc avg: {:?}", acc);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue