h

Dependencies:   MMA7660 USBDevice mbed

Fork of lecture2_demo2 by Colin Johnson

Files at this revision

API Documentation at this revision

Comitter:
co657_mh560
Date:
Thu Nov 19 12:12:13 2015 +0000
Parent:
7:23de08e003ec
Commit message:
hello

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Oct 28 03:32:05 2015 +0000
+++ b/main.cpp	Thu Nov 19 12:12:13 2015 +0000
@@ -1,24 +1,36 @@
 #include "mbed.h"
-#include "USBKeyboard.h"
+
 #include "MMA7660.h" /* for the accelerometer */
 
-USBKeyboard keyboard;
+
 MMA7660 MMA(D14, D15); /* accelerometer */
+Serial xbee (D1, D0);
 
 int main(void)
 {
     float x,y,countdown;
+
     countdown = 0.0;
     while (1) {
         x = MMA.x();
         y = MMA.y();
-        if (y>0.6f) { keyboard.mediaControl(KEY_VOLUME_DOWN); }
-        if (y<-0.6f) { keyboard.mediaControl(KEY_VOLUME_UP); }
-        if ((abs(x)>0.6f)&&(countdown<=0.0f)) {
-            keyboard.mediaControl(KEY_PLAY_PAUSE); 
+        if (y>0.6f) 
+        {
+        xbee.printf("d"); 
+        } 
+        if (y<-0.6f) 
+        {
+        xbee.printf("u"); 
+        }
+        if ((abs(x)>0.6f)&&(countdown<=0.0f)) 
+        {
+            
+            xbee.printf("p");
             countdown = 10.0f;
+          
             }
         countdown -= 1.0f;
         wait (0.1);
+  
     }
 }
\ No newline at end of file