Code to run tests on the Ethernet library
Dependencies: EthernetInterface mbed-rtos mbed
Diff: main.cpp
- Revision:
- 0:3f5638515f99
- Child:
- 1:effed2d57b6c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Oct 27 09:59:50 2013 +0000 @@ -0,0 +1,26 @@ +#include "mbed.h" +#include "EthernetInterface.h" + +int main() { + EthernetInterface eth; + eth.init("192.168.9.8", "255.255.255.0", "192.168.9.1"); + eth.connect(); + printf("IP Address is %s\n", eth.getIPAddress()); + + UDPSocket sock; + sock.init(); + + Endpoint seven; + seven.set_address("192.168.9.7", 37); + + char out_buffer[] = "plop"; // Does not matter + + while(1) { + sock.sendTo(seven, out_buffer, sizeof(out_buffer)); + wait(1); + } + + sock.close(); + + eth.disconnect(); +}