Program is a work in progress

Dependencies:   4DGL-uLCD-SE PinDetect SDFileSystem mbed-rtos mbed wave_player

Fork of 4180_Lab4_v6 by Scott Williams

Revision:
1:e84085bbf399
Parent:
0:9f1095365b9a
--- a/Robot.h	Sat Oct 29 22:15:03 2016 +0000
+++ b/Robot.h	Sun Oct 30 04:39:01 2016 +0000
@@ -2,9 +2,13 @@
 class Robot
 {
     Mutex stdio_mutex;
+    int frog_x, frog_y;
+    
 public:
     void drawFrog() {
-    uLCD.filled_rectangle(XPosition-5,YPosition-5,XPosition+5,YPosition+5,RED);
+        frog_x=60;
+        frog_y=115;
+    uLCD.filled_rectangle(frog_x,frog_y,frog_x+5,frog_y+5,RED);
     }
     
     void drawOutline() {
@@ -90,16 +94,36 @@
     }
     
     void moveForward() {
-    setYPosition(getYPosition() - 21);
+      stdio_mutex.lock();
+    uLCD.filled_rectangle(frog_x,frog_y,frog_x+5,frog_y+5,BLACK);
+    frog_y=frog_y-6;
+   
+    uLCD.filled_rectangle(frog_x,frog_y,frog_x+5,frog_y+5,RED);
+    stdio_mutex.unlock();
     }
     void moveBackward() {
-    setYPosition(getYPosition() + 21);
+     stdio_mutex.lock();
+    uLCD.filled_rectangle(frog_x,frog_y,frog_x+5,frog_y+5,BLACK);
+    frog_y=frog_y+6;
+   
+    uLCD.filled_rectangle(frog_x,frog_y,frog_x+5,frog_y+5,RED);
+    stdio_mutex.unlock();
     }
     void moveLeft() {
-    setXPosition(getXPosition() - 21);
+     stdio_mutex.lock();
+    uLCD.filled_rectangle(frog_x,frog_y,frog_x+5,frog_y+5,BLACK);
+    frog_x=frog_x-6;
+   
+    uLCD.filled_rectangle(frog_x,frog_y,frog_x+5,frog_y+5,RED);
+    stdio_mutex.unlock();
     }
     void moveRight() {
-    setXPosition(getXPosition() + 21);
+     stdio_mutex.lock();
+    uLCD.filled_rectangle(frog_x,frog_y,frog_x+5,frog_y+5,BLACK);
+    frog_x=frog_x+6;
+   
+    uLCD.filled_rectangle(frog_x,frog_y,frog_x+5,frog_y+5,RED);
+    stdio_mutex.unlock();
     }
     
     int getXPosition() {