[][src]Module rpi_embedded::adxl

Interface for the accelerometer ADXL345 using I2C

Refer to the I2C documentation to see how it is physicaly connected. The library allows the user to wakeup the accelerometer and read from it reliably it also calulates the rotations (roll and pitch).

Interupts are currently in development and should be out soon

Basic usage

this example should show basic usage of the library


let mut accel = Adxl::new(); accel.start(); accel.get_offsets(); accel.get_power_status(); println!("I2C ID: {} \t Power Status: {} \t XYZ Offsets ({}, {}, {})",accel.id, accel.power_status, accel.offsets[0],accel.offsets[1],accel.offsets[2]); accel.set_power_status(8); accel.get_data(); println!("GOT clean [ {:?} ]",accel.data); println!("Got rotations[ {} , {} ]",accel.pitch , accel.roll);