Just a test program.

Dependencies:   EthernetNetIf mbed

Files at this revision

API Documentation at this revision

Comitter:
sjwb99
Date:
Mon Feb 21 02:02:40 2011 +0000
Commit message:

Changed in this revision

EthernetNetIf.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.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EthernetNetIf.lib	Mon Feb 21 02:02:40 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mamezu/code/EthernetNetIf/#0f6c82fcde82
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Feb 21 02:02:40 2011 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+#include "EthernetNetIf.h"
+#include "UDPSocket.h"
+
+EthernetNetIf eth;
+UDPSocket udp;
+
+int main() {
+  printf("Setting up...\n");
+  EthernetErr ethErr = eth.setup();
+  if(ethErr)
+  {
+    printf("Error %d in setup.\n", ethErr);
+    return -1;
+  }
+  printf("Setup OK\n");
+  
+  // Use the IP of the client.
+  Host unicast(IpAddr(192,168,0,2), 21567, NULL);
+ 
+  udp.bind(unicast);
+  
+  char sampleStr[256];
+  
+  udp.sendto("hello", 5, &unicast);  // The first packet disappears.
+  wait(0.1);
+  
+ // while(true)
+ // {
+    Net::poll();
+    uint16_t x = 301;
+    for (int i = 0; i < 200; i+=2) {
+      sampleStr[i + 1] = x & 0xff;
+      sampleStr[i] = (x >> 8) & 0xff;
+      //printf("s[0] = %d s[1] = %d  ", sampleStr[i], sampleStr[i+1]);
+      printf("%d ", x);
+      x += 200; 
+    }
+    udp.sendto(sampleStr, 200, &unicast);
+    wait(10);
+ // }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Feb 21 02:02:40 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912