player 1

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

Fork of 4180FinalLab by Rishi Bhargava

Wireless 2 Player Pong game

Files at this revision

API Documentation at this revision

Comitter:
Mpmart08
Date:
Wed Apr 27 15:23:41 2016 +0000
Parent:
6:9cdde66d7502
Child:
8:8cc2aa78348c
Commit message:
stuff

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Apr 26 18:54:13 2016 +0000
+++ b/main.cpp	Wed Apr 27 15:23:41 2016 +0000
@@ -13,6 +13,7 @@
 //Speaker
 Speaker mySpeaker(p25);
 Serial pc(USBTX, USBRX);
+Serial xbee(p9, p10);
  
 // State machine definitions
 enum gameStateType {START, WAIT, GAME_SETUP, GAME, WIN, LOSE};
@@ -81,6 +82,19 @@
         }
     }
 }
+
+// thread that writes to the sd card
+void sd_card_thread(void const *argument) {
+
+    while (true) {
+        switch (gameState) {
+        case WIN:
+        case LOSE:
+            
+            break;
+        }
+    }
+}
  
 int main() 
 {   
@@ -115,6 +129,7 @@
     }
     
     Thread thread1(speaker_thread);
+    Thread thread2(sd_card_thread);
     
     while (1) 
     {
@@ -191,7 +206,7 @@
                 
                 ball.update();
                 botMove = -joystick.yAxis();
-                if (botMove < -0.25 || botMove > 0.25) {
+                if (botMove < -0.1 || botMove > 0.1) {
                     botPaddle.move(botMove);
                 }
                 //GET OTHER PADDLE SPOT AND UPDATE topPaddle