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.
main.cpp
00001 /* Program Example 12.8: Ethernet read 00002 */ 00003 #include "mbed.h" 00004 Ethernet eth; // Ethernet object 00005 Serial pc(USBTX, USBRX); // tx, rx for host terminal coms 00006 char buf[0xFF]; // create a large buffer to store data 00007 int main() { 00008 pc.printf("Ethernet data read and display\n\r"); 00009 while (1) { 00010 int size = eth.receive(); // get size of incoming data packet 00011 if (size > 0) { // if packet received 00012 eth.read(buf, size); // read packet to data buffer 00013 pc.printf("size = %d data = ",size); // print to screen 00014 for (int i=0;i<size;i++) { // loop for each data byte 00015 pc.printf("%02X ",buf[i]); // print data to screen 00016 } 00017 pc.printf("\n\r"); 00018 } 00019 } 00020 } 00021
Generated on Tue Aug 9 2022 19:16:32 by
1.7.2