ban4jp - / Mbed 2 deprecated Test_UDP

Dependencies:   EthernetInterface mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
ban4jp
Date:
Mon Oct 13 06:26:10 2014 +0000
Commit message:
UDP test example code.

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	Mon Oct 13 06:26:10 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/EthernetInterface/#5887ae6c0c2c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Oct 13 06:26:10 2014 +0000
@@ -0,0 +1,35 @@
+#include "mbed.h"
+#include "EthernetInterface.h"
+#include "UDPSocket.h"
+
+EthernetInterface eth;
+UDPSocket udpClient;
+Endpoint epServer;
+
+Serial pc(USBTX, USBRX);
+DigitalOut myled1(LED1);
+DigitalOut myled2(LED2);
+
+const char SENDDATA[] = "testtesttesttesttesttesttesttest";
+
+int main()
+{
+    pc.printf("eth.init() dhcp return = %d\n", eth.init());
+    //pc.printf("eth.init() static return = %d\n", eth.init("192.168.0.38", "255.255.255.0", "192.168.0.38"));
+
+    eth.connect();
+    udpClient.init();
+    
+    epServer.set_address("239.168.1.1", 38383);
+    pc.printf("IP Address = %s\n", eth.getIPAddress());
+
+    while(1) {
+        for(int i=16; i<=sizeof(SENDDATA); i++) {
+            myled1 = !myled1;
+            udpClient.sendTo(epServer, (char * )&SENDDATA, i);
+            wait(0.25);
+        }
+        myled2 = !myled2;
+        wait(2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Mon Oct 13 06:26:10 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rtos/#631c0f1008c3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Oct 13 06:26:10 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file