1.. zephyr:code-sample:: fxos8700 2 :name: FXOS8700 Accelerometer/Magnetometer Sensor 3 :relevant-api: sensor_interface 4 5 Get accelerometer and magnetometer data from an FXOS8700 sensor (polling & trigger mode). 6 7Overview 8******** 9 10This sample application shows how to use the FXOS8700 driver. 11The driver supports FXOS8700 accelerometer/magnetometer and 12MMA8451Q, MMA8652FC, MMA8653FC accelerometers. 13 14Building and Running 15******************** 16 17This project outputs sensor data to the console. FXOS8700 18sensor is present on the :zephyr:board:`frdm_k64f`, :zephyr:board:`frdm_k22f`, 19:zephyr:board:`frdm_kw41z`, :ref:`hexiwear`, and :zephyr:board:`twr_ke18f` boards. 20Accelerometer only devices are present on the :zephyr:board:`frdm_kl25z`, 21:zephyr:board:`bbc_microbit`, and :ref:`reel_board` boards. It does not work on 22QEMU. 23 24Building and Running for FRDM-K64F 25================================== 26FRDM-K64F is equipped with FXOS8700CQ accelerometer and magnetometer. 27Sample can be built and executed for the FRDM-K64F as follows: 28 29.. zephyr-app-commands:: 30 :zephyr-app: samples/sensor/fxos8700 31 :board: frdm_k64f 32 :goals: build flash 33 :compact: 34 35Example building for the FRDM-K64F with motion detection support: 36 37.. zephyr-app-commands:: 38 :zephyr-app: samples/sensor/fxos8700 39 :board: frdm_k64f 40 :conf: "prj.conf overlay-motion.conf" 41 :goals: build flash 42 :compact: 43 44Building and Running for FRDM-K22F 45================================== 46FRDM-K22F is equipped with FXOS8700CQ accelerometer and magnetometer. 47Sample can be built and executed for the FRDM-K22F as follows: 48 49.. zephyr-app-commands:: 50 :zephyr-app: samples/sensor/fxos8700 51 :board: frdm_k22f 52 :goals: build flash 53 :compact: 54 55Example building for the FRDM-K22F with motion detection support: 56 57.. zephyr-app-commands:: 58 :zephyr-app: samples/sensor/fxos8700 59 :board: frdm_k22f 60 :conf: "prj.conf overlay-motion.conf" 61 :goals: build flash 62 :compact: 63 64Building and Running for TWR-KE18F 65================================== 66TWR-KE18F is equipped with FXOS8700CQ accelerometer and magnetometer. 67The FXOS8700CQ IRQ lines, however, are not connected by default, so 68motion detection is not supported. 69 70Sample can be built and executed for the TWR-KE18F as follows: 71 72.. zephyr-app-commands:: 73 :zephyr-app: samples/sensor/fxos8700 74 :board: twr_ke18f 75 :goals: build flash 76 :compact: 77 78Building and Running for FRDM-KL25Z 79=================================== 80FRDM-KL25Z is equipped with MMA8451Q accelerometer. 81Sample can be built and executed for the FRDM-KL25Z as follows: 82 83.. zephyr-app-commands:: 84 :zephyr-app: samples/sensor/fxos8700 85 :board: frdm_kl25z 86 :conf: "prj_accel.conf" 87 :goals: build flash 88 :compact: 89 90Building and Running for Micro Bit 91================================== 92Micro Bit is equipped with MMA8653FC accelerometer. 93Sample can be built and executed for the Micro Bit as follows: 94 95.. zephyr-app-commands:: 96 :zephyr-app: samples/sensor/fxos8700 97 :board: bbc_microbit 98 :conf: "prj_accel.conf" 99 :goals: build flash 100 :compact: 101 102Building and Running for reel board 103=================================== 104The reel board is equipped with MMA8652FC accelerometer. 105Sample can be built and executed for the reel board as follows: 106 107.. zephyr-app-commands:: 108 :zephyr-app: samples/sensor/fxos8700 109 :board: reel_board 110 :conf: "prj_accel.conf" 111 :goals: build flash 112 :compact: 113 114Building and Running for MIMXRT685-EVK 115====================================== 116MIMXRT685-EVK is equipped with FXOS8700CQ accelerometer and magnetometer. 117Sample can be built and executed for the MIMXRT685-EVK as follows: 118 119.. zephyr-app-commands:: 120 :zephyr-app: samples/sensor/fxos8700 121 :board: mimxrt685_evk/mimxrt685s/cm33 122 :goals: build flash 123 :compact: 124 125Building and Running for MIMXRT595-EVK 126====================================== 127MIMXRT595-EVK is optionally equipped with FXOS8700CQ accelerometer and magnetometer. 128Please confirm the FXOS8700CQ(U6) is populated on your board. 129Sample can be built and executed for the MIMXRT595-EVK as follows: 130 131.. zephyr-app-commands:: 132 :zephyr-app: samples/sensor/fxos8700 133 :board: mimxrt595_evk/mimxrt595s/cm33 134 :goals: build flash 135 :compact: 136 137Sample Output 138============= 139 140.. code-block:: console 141 142 AX= -0.191537 AY= 0.067037 AZ= 9.902418 MX= 0.379000 MY= 0.271000 MZ= -0.056000 T= 22.080000 143 AX= -0.162806 AY= 0.143652 AZ= 9.940725 MX= 0.391000 MY= 0.307000 MZ= -0.058000 T= 22.080000 144 AX= -0.172383 AY= 0.134075 AZ= 9.969455 MX= 0.395000 MY= 0.287000 MZ= -0.017000 T= 22.080000 145 AX= -0.210690 AY= 0.105344 AZ= 9.911994 MX= 0.407000 MY= 0.306000 MZ= -0.068000 T= 22.080000 146 AX= -0.153229 AY= 0.124498 AZ= 9.950302 MX= 0.393000 MY= 0.301000 MZ= -0.021000 T= 22.080000 147 AX= -0.153229 AY= 0.095768 AZ= 9.921571 MX= 0.398000 MY= 0.278000 MZ= -0.040000 T= 22.080000 148 AX= -0.162806 AY= 0.105344 AZ= 9.902418 MX= 0.372000 MY= 0.300000 MZ= -0.046000 T= 22.080000 149 150<repeats endlessly> 151