meddahi hadj
/
hadjessais
DEUXIEME PROG
Diff: ethernet.cpp
- Revision:
- 1:32ebac4d3716
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ethernet.cpp Thu Feb 19 13:29:00 2015 +0000 @@ -0,0 +1,20 @@ +#include "mbed.h" + +Ethernet eth; + +int ether() { + char buf[0x600]; + + while(1) { + int size = eth.receive(); + if(size > 0) { + eth.read(buf, size); + printf("Destination: %02X:%02X:%02X:%02X:%02X:%02X\n", + buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]); + printf("Source: %02X:%02X:%02X:%02X:%02X:%02X\n", + buf[6], buf[7], buf[8], buf[9], buf[10], buf[11]); + } + + wait(1); + } +}