Display text on screen.

Dependencies:   TextLCD mbed MaxSonar RTC-DS1307

Fork of TextLCD_HelloWorld by Simon Ford

Revision:
12:75b8081e1304
Parent:
11:f6a39ae5ecbc
Child:
13:95eea857ed37
--- a/main.cpp	Thu May 25 11:55:41 2017 +0000
+++ b/main.cpp	Thu May 25 12:09:54 2017 +0000
@@ -56,7 +56,7 @@
     float r2;
 int main() {
     
-    UpdateScreen(questionScreen, 5, "0", 7, "___");
+    //UpdateScreen(questionScreen, 5, "0", 7, "___");
     
     /*questionScreen = 1;
     
@@ -67,7 +67,7 @@
         lcd.locate(2, 1);
         lcd.printf("===");
     }*/
-    wait(5);
+    //wait(5);
     
     // Create and configure object for 3.3V powered LV-series device, 
     // accessed with analog reads (in cm) on p16, triggered by p7.
@@ -207,7 +207,51 @@
 
 void Pong()
 {
+    bool pong = true;
+    
+    //player
+    int pLocation = 5;
+    string player = "___";
+    
+    //ball
+    string ball = 0;
+    
+    int ballPX = 0;
+    int ballPY = 0;
+    
+    int ballVX = 1;
+    int ballVY = 1;
+    
+    UpdateScreen(questionScreen, "Welcome to Pong!");
+    UpdateScreen(screen2, 0, "", pLocation, player);
+    
+    while(pong)
+    {
+        UpdateRange();
+        if(CheckExit(r1, r2))
+        {
+            GameOption();
+        }
         
+        if(r2 < 20)
+        {
+            if(pLocation > 0) 
+            { 
+                pLocation--; 
+                UpdateScreen(screen2, 0, "", pLocation, player);
+            }
+        }
+        if(r1 < 20)
+        {
+            if(pLocation < 12) 
+            { 
+                pLocation++; 
+                UpdateScreen(screen2, 0, "", pLocation, player);
+            }
+        }
+        
+        wait(0.5);
+    }
 }
 
 string exitOption[2] = {"Yes", "No"};