Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface mbed-rtos mbed
main.cpp
00001 #include "mbed.h" 00002 #include "EthernetInterface.h" 00003 #include "UDPSocket.h" 00004 00005 EthernetInterface eth; 00006 UDPSocket udpClient; 00007 Endpoint epServer; 00008 00009 Serial pc(USBTX, USBRX); 00010 DigitalOut myled1(LED1); 00011 DigitalOut myled2(LED2); 00012 00013 const char SENDDATA[] = "testtesttesttesttesttesttesttest"; 00014 00015 int main() 00016 { 00017 pc.printf("eth.init() dhcp return = %d\n", eth.init()); 00018 //pc.printf("eth.init() static return = %d\n", eth.init("192.168.0.38", "255.255.255.0", "192.168.0.38")); 00019 00020 eth.connect(); 00021 udpClient.init(); 00022 00023 epServer.set_address("239.168.1.1", 38383); 00024 pc.printf("IP Address = %s\n", eth.getIPAddress()); 00025 00026 while(1) { 00027 for(int i=16; i<=sizeof(SENDDATA); i++) { 00028 myled1 = !myled1; 00029 udpClient.sendTo(epServer, (char * )&SENDDATA, i); 00030 wait(0.25); 00031 } 00032 myled2 = !myled2; 00033 wait(2); 00034 } 00035 }
Generated on Wed Jul 20 2022 07:06:58 by
1.7.2