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: C12832 MMA7660 mbed
Fork of app-shield-accelerometer by
Revision 6:305ed72790a4, committed 2015-11-02
- Comitter:
- rtk
- Date:
- Mon Nov 02 22:36:41 2015 +0000
- Parent:
- 5:636ebfdf373b
- Commit message:
- .
Changed in this revision
diff -r 636ebfdf373b -r 305ed72790a4 MMA7660.lib --- a/MMA7660.lib Thu Feb 06 17:00:28 2014 +0000 +++ b/MMA7660.lib Mon Nov 02 22:36:41 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/Sissors/code/MMA7660/#a8e20db7901e +http://mbed.org/users/Sissors/code/MMA7660/#36a163511e34
diff -r 636ebfdf373b -r 305ed72790a4 main.cpp
--- a/main.cpp Thu Feb 06 17:00:28 2014 +0000
+++ b/main.cpp Mon Nov 02 22:36:41 2015 +0000
@@ -4,17 +4,46 @@
// Using Arduino pin notation
C12832 lcd(D11, D13, D12, D7, D10);
-MMA7660 MMA(SDA,SCL);
+MMA7660 MMA(I2C_SDA,I2C_SCL);
+enum Orientation {Up, Down,
+ Right, Left,
+ Back, Front,
+ Unknown
+ };
int main()
{
lcd.cls();
lcd.locate(0,3);
- lcd.printf("mbed application shield!");
+ // lcd.printf("mbed application shield!");
while(1) {
- lcd.locate(0,14);
- lcd.printf("x=%.2f y=%.2f z=%.2f",MMA.x(), MMA.y(), MMA.z());
+ lcd.locate(60,0);
+ lcd.printf("x=%.2f",MMA.x());
+ lcd.locate(60,8);
+ lcd.printf("y=%.2f",MMA.y());
+ lcd.locate(60,16);
+ lcd.printf("z=%.2f",MMA.z());
+ lcd.locate(0,8);
+ if (MMA.getSide()==Front) lcd.printf("Front");
+ else if (MMA.getSide()==Back) lcd.printf("Back");
+ lcd.locate(0,16);
+ switch (MMA.getOrientation()) {
+ case Left :
+ lcd.printf("Left");
+ break;
+ case Right :
+ lcd.printf("Right");
+ break;
+ case Up :
+ lcd.printf(" ");lcd.locate(0,16);
+ lcd.printf("Up");
+ break;
+ case Down :
+ lcd.printf("Down");
+ break;
+ }
+
wait(0.2);
}
}
diff -r 636ebfdf373b -r 305ed72790a4 mbed.bld --- a/mbed.bld Thu Feb 06 17:00:28 2014 +0000 +++ b/mbed.bld Mon Nov 02 22:36:41 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/cd19af002ccc \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/9296ab0bfc11 \ No newline at end of file
