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: MMA7660 USBDevice mbed
Revision 0:af4531cbeb8b, committed 2016-03-24
- Comitter:
- cohenr
- Date:
- Thu Mar 24 17:19:03 2016 +0000
- Commit message:
- Emulating a mouse.
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MMA7660.lib Thu Mar 24 17:19:03 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Sissors/code/MMA7660/#36a163511e34
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/USBDevice.lib Thu Mar 24 17:19:03 2016 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/sparkfun/code/USBDevice/#2af474687369
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Mar 24 17:19:03 2016 +0000
@@ -0,0 +1,40 @@
+// USB Device demo - control mouse pointer with buttons
+
+#include "mbed.h"
+#include "USBMouse.h"
+#include "MMA7660.h"
+
+MMA7660 MMA(p28, p27);
+
+
+// USB Mouse object
+USBMouse mouse;
+
+DigitalOut myled(LED1);
+
+int main() {
+
+ if (MMA.testConnection())myled = 1;
+ int x = 0;
+ int y = 0;
+
+
+ while (1) {
+
+
+ // Move mouse
+ if (MMA.x()>0.3) x = 1;
+ else if (MMA.x()<-0.3) x = -1;
+ else x = 0;
+
+ if (MMA.y()>0.3) y = 1;
+ else if (MMA.y()<-0.3) y = -1;
+ else y = 0;
+
+
+ mouse.move(x, y);
+
+ // Wait for next cycle
+ wait(0.001);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Mar 24 17:19:03 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/c0f6e94411f5 \ No newline at end of file