Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: ADXL362 mbed MPL3115A2
Revision 9:a14593af628d, committed 2018-02-22
- Comitter:
- htdoughe
- Date:
- Thu Feb 22 21:11:24 2018 +0000
- Parent:
- 8:9c9d58ca2b79
- Child:
- 10:8dcc46dd53bf
- Commit message:
- vibration?
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Feb 22 20:42:09 2018 +0000
+++ b/main.cpp Thu Feb 22 21:11:24 2018 +0000
@@ -1,8 +1,8 @@
#include "mbed.h"
#include "ADXL362.h"
#include "string.h"
-#include <map>
-#include <string>
+
+DigitalOut led1(LD3);
//map of register values and names
int regids[34];
@@ -138,11 +138,19 @@
start = 0;
length = 5;
adxl362_reg_print(start, length);
+ initx=adxl362.scanx_u8();
+ inity=adxl362.scany_u8();
+ initz=adxl362.scanz_u8();
while(1) {
x=adxl362.scanx_u8();
y=adxl362.scany_u8();
z=adxl362.scanz_u8();
+ if(x > initx+2 || y > inity+2 || z > initz+2){
+ led1 = 1;
+ wait_ms(200);
+ led1 = 0;
+ }
printf("x = %d y = %d z = %d\r\n",x,y,z);
wait_ms(100);
}