FXOS8700CQ class modified for el17yfk
Diff: FXOS8700CQ.h
- Revision:
- 1:09311e0a2c64
- Parent:
- 0:f66eda6a492a
- Child:
- 2:1a98f69712e8
--- a/FXOS8700CQ.h Tue Jan 31 19:02:23 2017 +0000 +++ b/FXOS8700CQ.h Sat Feb 04 14:01:00 2017 +0000 @@ -1,9 +1,38 @@ -/* FXOS8700CQ Library +/** @file FXOS8700CQ.h + +@ brief FXOS8700CQ Library + +@author Dr Craig A. Evans +@brief (c) University of Leeds, Jan 2017 + +@code + +#include "mbed.h" +#include "FXOS8700CQ.h" + +// create object and specifiy pins +FXOS8700CQ device(I2C_SDA,I2C_SCL); -Sample code from ELEC2645 - demonstrates how to create a library -for the K64F on-board accelerometer and magnetometer +int main() +{ + // call initialisation method + device.init(); -(c) Craig A. Evans, University of Leeds, Jan 2017 + while (1) { + + // poll the sensor and get the values, storing in a struct + Data values = device.get_values(); + + // print each struct member over serial + printf("ax = %f ay = %f az = %f | mx = %f my = %f mz = %f\n" + ,values.ax, values.ay, values.az + ,values.mx, values.my, values.mz); + + wait(0.5); + } +} + +@endcode */