basic code
Dependencies: MMA8451Q USBDevice mbed
Fork of FRDM_MMA8451Q by
Revision 8:bdeeb2b975a8, committed 2013-11-10
- Comitter:
- trisjph
- Date:
- Sun Nov 10 20:50:29 2013 +0000
- Parent:
- 7:70775be9f474
- Commit message:
- initial commit
Changed in this revision
USBDevice.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 70775be9f474 -r bdeeb2b975a8 USBDevice.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/USBDevice.lib Sun Nov 10 20:50:29 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/USBDevice/#335f2506f422
diff -r 70775be9f474 -r bdeeb2b975a8 main.cpp --- a/main.cpp Tue Feb 19 23:46:45 2013 +0000 +++ b/main.cpp Sun Nov 10 20:50:29 2013 +0000 @@ -3,6 +3,8 @@ #define MMA8451_I2C_ADDRESS (0x1d<<1) +USBMouseKeyboard key_mouse; + int main(void) { MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS); PwmOut rled(LED_RED); @@ -11,8 +13,10 @@ while (true) { rled = 1.0 - abs(acc.getAccX()); + key_mouse.move(-acc.getAccX()*10, 0); gled = 1.0 - abs(acc.getAccY()); + key_mouse.move(0, acc.getAccY()*10); bled = 1.0 - abs(acc.getAccZ()); - wait(0.1); + wait_ms(5); } }