Accelerations in 3D with Analog Devices ADXL362. The PmodACL2 was used but should work with almost any sensor module with the ADXL362. The ADXL362 connects with SPI. The library ADXL362 published by Analog Devises includes the necessary methods for setting up the sensor and reading the acceleration results.

Dependencies:   ADXL362

Files at this revision

API Documentation at this revision

Comitter:
timo_k2
Date:
Wed Dec 30 15:19:15 2020 +0000
Parent:
5:4d6ef028eeae
Child:
7:652e2c5ad650
Commit message:
updated for OS6, printing notes on register defaults, calculating derivative.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Dec 30 14:41:19 2020 +0000
+++ b/main.cpp	Wed Dec 30 15:19:15 2020 +0000
@@ -1,7 +1,42 @@
+/*
+* Copyright (c) 2006-2020 Arm Limited and affiliates.
+* SPDX-License-Identifier: Apache-2.0
+*******************************************************************************
+* Pmod_ACL2_ADXL362_L432KC_OS6
+*
+* Accelerations in 3D with Analog Devices ADXL362. The PmodACL2 was used but 
+* should work with almost any sensor module with the ADXL362.
+* The ADXL362 connects with SPI. The library ADXL362 published by Analog Devises 
+* includes the necessary methods for setting up the sensor and reading the 
+* acceleration results. 
+*
+* Hardware
+* ST NUCLEO L432KC or almost any other MbedOS microcontroller, 
+* Digilent PmodACL2 sensor module with the ADXL362 acceleration sensor
+* A LED with 220 Ohm series resistor for indicating movement 
+*
+* Connect:
+* L432KC D13 - ACL2 4 SCLK   hardware defined for the SPI
+* L432KC D12 - ACL2 3 MISO  hardware defined for the SPI
+* L432KC D11 - ACL2 2 MOSI 
+* L432KC D5  - ACL2 1 CS  or any other free
+*  GND     - ACL2 5 GND
+*  Vcc     - ACL2 6 Vcc
+* The ACL2 pins 7 and 8 will be connected if hardware interrupts will be used.
+* L432KC D1 - LED - 220 Ohm - GND
+*
+* Reference:
+* PmodACL2 https://reference.digilentinc.com/reference/pmod/pmodacl2/start
+* ADXL362 https://www.analog.com/en/products/adxl362.html
+* Datasheet for register reference 
+* https://www.analog.com/media/en/technical-documentation/data-sheets/ADXL362.pdf
+*
+* Timo Karppinen 30.12.2020        Apache-2.0
+******************************************************************************/
+
 #include "mbed.h"
 #include "ADXL362.h"
 
-
 // ADXL362::ADXL362(PinName CS, PinName MOSI, PinName MISO, PinName SCK) :
 ADXL362 ADXL362(D5,D11,D12,D13);
 
@@ -49,8 +84,6 @@
             break;
      
             printf("x = %3d    y = %3d    z = %3d   dx = %3d    dy = %3d    dz = %3d\r\n",x,y,z,dx,dy,dz);
-            //pc.printf("x = %d, y = %d, z = %d\r\n", x1, y1, z1);
-            //wait_ms(10);
             ThisThread::sleep_for(100ms);
         }