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 res = acc.get_x().unwrap(); let xyz = acc.get_xyz().unwrap(); println!("{}",xyz.x); println!("{}",xyz.y); println!("{}",xyz.z); 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 |