Crate mma7660fc [−] [src]
A platform agnostic driver to interface with the MMA7660FC 3-Axis Accelerometer via I2C This chip can be found on Seeed's Grove 3-Axis Digital Accelerometer with range ±1.5g (6-bit, signed)
This driver was built using embedded-hal
traits.
Example : Reading accelerometer values on RPi
extern crate linux_embedded_hal as hal; extern crate mma7660fc; extern crate cast; use std::thread; use std::time::Duration; use cast::*; use hal::I2cdev; use mma7660fc::*; fn main(){ let dev = I2cdev::new("/dev/i2c-1").unwrap(); let mut acc = Mma7660fc::new(dev).unwrap(); loop{ let xyzRaw = acc.get_xyz().unwrap(); let acceleration = acc.get_acceleration().unwrap(); print!("X Raw: "); println!("{}",xyzRaw.x); print!("Y Raw: "); println!("{}",xyzRaw.y); print!("Z Raw: "); println!("{}",xyzRaw.z); println!(""); print!("X: "); println!("{}",acceleration.x); print!("Y: "); println!("{}",acceleration.y); print!("Z: "); println!("{}",acceleration.z); println!(""); thread::sleep(Duration::from_secs(1)); } }
Structs
Ax3 |
XYZ triple representing acceleration within range ±1.5g |
I8x3 |
XYZ triple representing raw values |
Mma7660fc |
MMA7660FC Driver |
Enums
Mode | |
Register |
Register addresses |
Constants
ADDRESS | |
SENSITIVITY |