multiplayer pong game for LPC 1768

Dependencies:   mbed MbedJSONValue mbed-rtos Adafruit_ST7735 Adafruit_GFX EthernetInterface DebouncedInterrupt

Revision:
34:b19f39ad74ac
Parent:
33:98ba7b0b8c2b
Child:
35:2c5e582a6ee2
--- a/main.cpp	Sat Nov 28 03:30:09 2020 +0000
+++ b/main.cpp	Sat Nov 28 03:52:32 2020 +0000
@@ -63,14 +63,15 @@
             GameState *gs = new GameState();
             numGamesPlayed++; 
             
-            // request an open lobby from the server 
-            sock.sendTo(nist, connectionRequest, strlen(connectionRequest)); 
-                        
             // change ISRs to game controls 
             leftButton.attach(&pressLeftGame, IRQ_RISE, DEBOUNCE);
             middleButton.reset(); 
             rightButton.attach(&pressRightGame, IRQ_RISE, DEBOUNCE);
             
+            // request an open lobby from the server 
+            sock.sendTo(nist, connectionRequest, strlen(connectionRequest)); 
+                    
+            printf("hello\n\r");
             while (!gs->done()) {
                 if (sendFlag != 0) {
                     serverRequest["type"] = "move"; 
@@ -108,7 +109,10 @@
             
             // cleanup the socket from the previous game
             int flushBytes = 0; 
-            while ((flushBytes = sock.receiveFrom(nist, tmp_buffer, sizeof(tmp_buffer))) != 0) {}
+            while ((flushBytes = sock.receiveFrom(nist, tmp_buffer, sizeof(tmp_buffer))) != 0) {
+                printf("reading bytes: %i\n\r", flushBytes); 
+                printf("tmp_buffer", tmp_buffer); 
+            }
              
             gfx->renderGameOver(gs);