The world's greatest etch a sketch

Dependencies:   mbed C12832 MMA7660

Files at this revision

API Documentation at this revision

Comitter:
jlaqua
Date:
Wed Feb 19 21:57:44 2014 +0000
Parent:
0:00653d8e42a1
Child:
2:aed0788e8f96
Commit message:
shake to erase works. getting accelerometer data every time sacrifices getting potentiometer often enough

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832.lib	Wed Feb 19 21:57:44 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/chris/code/C12832/#7de323fa46fe
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MMA7660.lib	Wed Feb 19 21:57:44 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Sissors/code/MMA7660/#a8e20db7901e
--- a/main.cpp	Wed Feb 19 17:30:11 2014 +0000
+++ b/main.cpp	Wed Feb 19 21:57:44 2014 +0000
@@ -1,12 +1,21 @@
 #include "mbed.h"
+#include "C12832.h"
+#include "MMA7660.h"
 
-DigitalOut myled(LED1);
+AnalogIn potX(p20);
+AnalogIn potY(p19);
+
+MMA7660 acc(p28, p27);
+
+C12832 lcd(p5, p7, p6, p8, p11);
 
 int main() {
     while(1) {
-        myled = 1;
-        wait(0.2);
-        myled = 0;
-        wait(0.2);
+        int x = (int)((1-potX) * lcd.width());
+        int y = (int)((1-potY) * lcd.height());
+        lcd.pixel(x, y, 1);
+        lcd.copy_to_lcd();
+        if ((acc.x() > 1.3) || (acc.y() > 1.3))
+            lcd.cls();
     }
 }