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: MMA8451Q SLCD_minus_mod mbed
Fork of ACC_LCD_341_Basic by
Revision 8:971f38affa78, committed 2016-11-28
- Comitter:
- dorian505
- Date:
- Mon Nov 28 00:23:12 2016 +0000
- Parent:
- 7:ae5c27eb1492
- Child:
- 9:b2768bb45a68
- Commit message:
- v
Changed in this revision
| acc_341.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/acc_341.cpp Mon Nov 21 01:09:16 2016 +0000
+++ b/acc_341.cpp Mon Nov 28 00:23:12 2016 +0000
@@ -16,7 +16,7 @@
#define xAxis 0
#define yAxis 1
#define zAxis 2
-#define DigitalIn button(LBUT)
+
#define PROGNAME "ACCLCD341-541\r\n"
#define PRINTDBUG
@@ -39,7 +39,7 @@
MMA8451Q acc(SDA, SCL, MMA8451_I2C_ADDRESS);
Serial pc(USBTX, USBRX);
Timer dataTimer;
-
+DigitalIn button(LBUT)
void LCDMess(char *lMess){
@@ -72,8 +72,11 @@
// main loop forever
//Get accelerometer data - tilt angles minus offset for zero mark.
while (true) {
- for (int i=0; i < digitalIn; i++){ // index will be 0 or 1
- if(!digitalIn) { // a buttton is pressed
+ if (ButtonTimer > BUTTONTIME){
+ buttonValue = !buttons[1].read();
+ for (int i=0; i < NUMBUTS; i++){ // index will be 0 or 1
+ if(!buttons[i]) {
+
//xAcc = acc.getAccX();
//yAcc = acc.getAccY();
//zAcc = acc.getAccZ();
@@ -95,10 +98,10 @@
// if ! buttons
#ifdef PRINTDBUG
- pc.printf("xAcc = %f\r\n", xAcc);
- pc.printf("yAcc = %f\r\n", yAcc);
- pc.printf("zAcc = %f\r\n", zAcc);
- pc.printf("LBUT = %f\r\n", LBUT);
+ // pc.printf("xAcc = %f\r\n", xAcc);
+ //pc.printf("yAcc = %f\r\n", yAcc);
+ //pc.printf("zAcc = %f\r\n", zAcc);
+ //pc.printf("LBUT = %f\r\n", LBUT);
#endif
// Wait then do the whole thing again.
