The keyboard section of the CO657 class 4

Dependencies:   C12832 MMA7660 mbed

Files at this revision

API Documentation at this revision

Comitter:
co657_sjc80
Date:
Thu Nov 19 18:05:08 2015 +0000
Commit message:
Initial commit

Changed in this revision

C12832.lib Show annotated file Show diff for this revision Revisions of this file
MMA7660.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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 85b0a266d4ac C12832.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832.lib	Thu Nov 19 18:05:08 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/askksa12543/code/C12832/#990d5eec2ef6
diff -r 000000000000 -r 85b0a266d4ac MMA7660.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MMA7660.lib	Thu Nov 19 18:05:08 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Sissors/code/MMA7660/#36a163511e34
diff -r 000000000000 -r 85b0a266d4ac main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 19 18:05:08 2015 +0000
@@ -0,0 +1,42 @@
+/**
+ * (C) Simon Cooksey, 2015
+ * 
+ *  Class 03, Task 1B -- XBee Remote Sender
+ *  MIT
+ */
+
+#include "mbed.h"
+#include "C12832.h"
+#include "MMA7660.h" /* for the accelerometer */
+
+MMA7660 MMA(D14, D15);              /* accelerometer */
+Serial xbee(D1, D0);                /* xbee */
+C12832 lcd(D11, D13, D12, D7, D10); /* lcd display*/
+
+// Based on Colin Johnson's code available at 
+// https://developer.mbed.org/users/colingj/code/lecture2_demo2/
+int main(void)
+{
+    float x,y;
+    int countdown = 0;
+    
+    lcd.locate(0,0);
+    lcd.printf("Remote");
+    
+    while (1) {
+        x = MMA.x();
+        y = MMA.y();
+        if (y>0.6f) { 
+            xbee.putc('d'); 
+        }
+        if (y<-0.6f) { 
+            xbee.putc('u');
+        }
+        if ((abs(x)>0.6f)&&(countdown<=0.0f)) {
+            xbee.putc('p');
+            countdown = 10;
+        }
+        countdown--;
+        wait (0.1);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 85b0a266d4ac mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Nov 19 18:05:08 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9296ab0bfc11
\ No newline at end of file