lab 6
Dependencies: ADXL362 mbed MPL3115A2
Diff: main.cpp
- Revision:
- 15:5ce9c63e7da2
- Parent:
- 14:0c2659ce7a8a
- Child:
- 16:993757c8b398
--- a/main.cpp Thu Feb 22 21:36:00 2018 +0000 +++ b/main.cpp Fri Feb 23 02:53:00 2018 +0000 @@ -145,6 +145,7 @@ initx=adxl362.scanx_u8(); inity=adxl362.scany_u8(); initz=adxl362.scanz_u8(); + int count = 0; while(1) { //get the values of x, y, and z to test for a knock @@ -154,6 +155,8 @@ //if x, y, or z vary from baseline by at least 3, a knock has occured. if(x > initx+2 || y > inity+2 || z > initz+2 || x > initx-2 || y > inity-2 || z > initz-2){ led1 = 1; + count++; + printf("number of knocks: %d\r\n", count); wait_ms(2000); led1 = 0; }