Demo program for the Eyes_uLCD-144-G2 micro LCD

Dependencies:   4DGL-uLCD-SE Eyes_uLCD-144-G2 mbed

Files at this revision

API Documentation at this revision

Comitter:
electromotivated
Date:
Tue Dec 15 00:37:41 2015 +0000
Child:
1:e0ff9b72733b
Commit message:
update;

Changed in this revision

4DGL-uLCD-SE.lib Show annotated file Show diff for this revision Revisions of this file
Eyes_uLCD-144-G2.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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/4DGL-uLCD-SE.lib	Tue Dec 15 00:37:41 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/4180_1/code/4DGL-uLCD-SE/#2cb1845d7681
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Eyes_uLCD-144-G2.lib	Tue Dec 15 00:37:41 2015 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/electromotivated/code/Eyes_uLCD-144-G2/#06df44729143
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Dec 15 00:37:41 2015 +0000
@@ -0,0 +1,63 @@
+/*
+    Eyes Class produces an LCD Object with Eyes that can look around, blink,
+    convey expressions, etc. 
+    
+    TODO: Replace "wait()" with Thread::wait() so that this isn't eating
+          up processor time!. Maybe could use a Ticker or Timer interrupt
+          but we don't want to call Eye methods until wait is complete...
+          so that probably isn't a good idea... Thread::wait() is probably 
+          best for an end application.
+          
+          OR add close_eyes to gesture() method and leave it to user to 
+          create blink gestures and other gestures that require waits...
+          this can be mentioned in the header and documentation with 
+          solutions the user can use.
+*/
+
+#include "mbed.h"
+#include "Eyes.h"
+
+
+Eyes eyes(p28, p27, p30); // serial tx, serial rx, reset pin;
+int main() {
+    while(1){
+        int dir = rand()%10;
+        Eyes::DIRECTION direction;
+        switch(dir){
+            case 0:
+                direction = Eyes::U;
+                break;
+            case 1:
+                direction = Eyes::D;
+                break;
+            case 2:
+                direction = Eyes::L;
+                break;
+            case 3:
+                direction = Eyes::R;
+                break;
+            case 4:
+                direction = Eyes::C;
+                break;
+            case 5:
+                direction = Eyes::UL;
+                break;
+            case 6:
+                direction = Eyes::UR;
+                break;
+            case 7:
+                direction = Eyes::DL;
+                break;
+            case 8:
+                direction = Eyes::DR;
+                break;        
+        }
+        eyes.look(direction);
+        eyes.draw();             // Call this after calling look() or express()
+        wait((rand()%10 + 1)*0.40);
+        eyes.gesture(Eyes::BLINK);
+        wait((rand()%10 + 1)*0.25);
+        if(rand()%2) eyes.gesture(Eyes::CLOSE);
+        wait((rand()%10 + 1)*0.25);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Dec 15 00:37:41 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68
\ No newline at end of file