
Just a test program.
Dependencies: EthernetNetIf mbed
Revision 0:92866ff9a157, committed 2011-02-21
- Comitter:
- sjwb99
- Date:
- Mon Feb 21 02:02:40 2011 +0000
- Commit message:
Changed in this revision
diff -r 000000000000 -r 92866ff9a157 EthernetNetIf.lib --- /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
diff -r 000000000000 -r 92866ff9a157 main.cpp --- /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
diff -r 000000000000 -r 92866ff9a157 mbed.bld --- /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