ECE4180 lab2 part 5
Dependencies: EthernetInterface mbed-rtos mbed
Fork of TCPSocket_HelloWorld by
Revision 15:da930157dc32, committed 2015-10-06
- Comitter:
- ycai47
- Date:
- Tue Oct 06 19:24:51 2015 +0000
- Parent:
- 14:72be2b8b7f24
- Commit message:
- 4180 lab2 part 5
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 72be2b8b7f24 -r da930157dc32 main.cpp --- a/main.cpp Wed May 14 15:07:26 2014 +0000 +++ b/main.cpp Tue Oct 06 19:24:51 2015 +0000 @@ -1,12 +1,31 @@ #include "mbed.h" #include "EthernetInterface.h" +Serial pc(USBTX, USBRX); // tx, rx + +extern "C" void mbed_mac_address(char *mac); + int main() { + + // to get the mac address of the mbed + char mac[6]; + mbed_mac_address(mac); + for(int i=0; i<6;i++) { + printf("%02X ", mac[i]); + } + printf("\n"); + EthernetInterface eth; eth.init(); //Use DHCP - eth.connect(); - printf("IP Address is %s\n", eth.getIPAddress()); + pc.printf("Testing Init"); + int err = eth.connect(15000); + if (err != 0 ) { + pc.printf("Error in connection error code is %d. \n", err); + } else { + // exit(1); + } + pc.printf("IP Address is %s\n", eth.getIPAddress()); TCPSocketConnection sock; sock.connect("mbed.org", 80);