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
Fork of BroadcastSend by
main.cpp
00001 #include "mbed.h" 00002 #include "EthernetInterface.h" 00003 00004 const int BROADCAST_PORT = 58083; 00005 00006 int main() { 00007 EthernetInterface eth; 00008 eth.init(); //Use DHCP 00009 eth.connect(); 00010 00011 UDPSocket sock; 00012 sock.init(); 00013 sock.set_broadcasting(); 00014 00015 Endpoint broadcast; 00016 broadcast.set_address("255.255.255.255", BROADCAST_PORT); 00017 00018 char out_buffer[] = "very important data"; 00019 00020 while (true) { 00021 printf("Broadcasting...\n"); 00022 sock.sendTo(broadcast, out_buffer, sizeof(out_buffer)); 00023 Thread::wait(1000); 00024 } 00025 }
Generated on Tue Jul 12 2022 16:18:24 by
