lab 6
Dependencies: ADXL362 mbed MPL3115A2
Diff: main.cpp
- Revision:
- 16:993757c8b398
- Parent:
- 15:5ce9c63e7da2
- Child:
- 17:6a08357dbb3f
--- a/main.cpp Fri Feb 23 02:53:00 2018 +0000 +++ b/main.cpp Fri Feb 23 16:47:22 2018 +0000 @@ -1,10 +1,11 @@ #include "mbed.h" #include "ADXL362.h" #include "string.h" +#include "MPL3115A2.h" DigitalOut led1(LED3); -//map of register values and names +//map of register values and names for the adxl int regids[34]; char* regnames[34]; //populating the map @@ -128,17 +129,8 @@ return 0; } -int main() { - initmap(); - adxl362.reset(); - wait_ms(600); // we need to wait at least 500ms after ADXL362 reset - adxl362.set_mode(ADXL362::MEASUREMENT); +void knocks(){ int8_t x,y,z, initx, inity, initz; - int start, length; - start = 0; - length = 5; - adxl362_reg_print(start, length); - //initial values of x, y, and z. //These values are the baseline for the accelerometer; knocks are detected // in relation to these initial values @@ -160,7 +152,22 @@ wait_ms(2000); led1 = 0; } - printf("x = %d y = %d z = %d\r\n",x,y,z); + //printf("x = %d y = %d z = %d\r\n",x,y,z); wait_ms(100); } } + +int main() { + initmap(); + adxl362.reset(); + wait_ms(600); // we need to wait at least 500ms after ADXL362 reset + adxl362.set_mode(ADXL362::MEASUREMENT); + int start, length; + start = 0; + length = 0; + while(1){ + adxl362_reg_print(start, length); + } + knocks(); + +}