multiplayer pong game for LPC 1768

Dependencies:   mbed MbedJSONValue mbed-rtos Adafruit_ST7735 Adafruit_GFX EthernetInterface DebouncedInterrupt

Files at this revision

API Documentation at this revision

Comitter:
donatien
Date:
Tue Jun 26 14:43:18 2012 +0000
Child:
1:8e1d4987eb90
Commit message:
Initial Commit

Changed in this revision

EthernetInterface.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-rtos.lib 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/EthernetInterface.lib	Tue Jun 26 14:43:18 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/EthernetInterface/#f5776537f27f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Jun 26 14:43:18 2012 +0000
@@ -0,0 +1,32 @@
+#include "mbed.h"
+#include "EthernetInterface.h"
+
+int main() 
+{
+    EthernetInterface eth;
+    eth.init(); //Use DHCP
+
+    eth.connect();
+    
+    UDPSocket sock;
+    sock.bind(0); //Use a random port
+    
+    const char daytime_cmd[] = "plop"; //Does not matter
+    sock.sendTo((std::uint8_t*)daytime_cmd, sizeof(daytime_cmd) - 1, "utcnist.colorado.edu", 37, 3000);
+    
+    char* inHost;
+    int inPort;
+    char in_buf[4];   
+    int ret = sock.receiveFrom((std::uint8_t*)in_buf, 4, &inHost, &inPort, 3000);
+      
+    std::uint32_t timeRes = ntohl( *((std::uint32_t*)in_buf));
+      
+    printf("Received %d bytes from server %s on port %d: %u seconds since 1/01/1900 00:00 GMT\n", ret, inHost, inPort, timeRes);
+      
+    sock.close();  
+    
+    eth.disconnect();  
+
+    while(1) {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Tue Jun 26 14:43:18 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rtos/#3cf1dd27c89c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Jun 26 14:43:18 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/976df7c37ad5
\ No newline at end of file