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 TCPSocket_HelloWorld by
Revision 15:bf59021c6f53, committed 2018-10-09
- Comitter:
- abraha2d
- Date:
- Tue Oct 09 00:48:43 2018 +0000
- Parent:
- 14:72be2b8b7f24
- Commit message:
- Save point
Changed in this revision
--- a/EthernetInterface.lib Wed May 14 15:07:26 2014 +0000 +++ b/EthernetInterface.lib Tue Oct 09 00:48:43 2018 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/EthernetInterface/#097a9996f8d5 +https://os.mbed.com/users/abraha2d/code/EthernetInterface/#966f601aa875
--- a/main.cpp Wed May 14 15:07:26 2014 +0000
+++ b/main.cpp Tue Oct 09 00:48:43 2018 +0000
@@ -1,18 +1,30 @@
#include "mbed.h"
#include "EthernetInterface.h"
-int main() {
+Serial pc(USBTX, USBRX);
+
+int main()
+{
+ pc.printf("Hi! ");
+
+ char mac[6];
+ mbed_mac_address(mac);
+ pc.printf("mbed MAC address is %02x:%02x:%02x:%02x:%02x:%02x\n\r", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+
+ pc.printf("1");
EthernetInterface eth;
+ pc.printf("2");
eth.init(); //Use DHCP
+ pc.printf("3");
eth.connect();
- printf("IP Address is %s\n", eth.getIPAddress());
-
+ pc.printf("IP Address is %s\n", eth.getIPAddress());
+
TCPSocketConnection sock;
sock.connect("mbed.org", 80);
-
+
char http_cmd[] = "GET /media/uploads/mbed_official/hello.txt HTTP/1.0\n\n";
sock.send_all(http_cmd, sizeof(http_cmd)-1);
-
+
char buffer[300];
int ret;
while (true) {
@@ -20,12 +32,12 @@
if (ret <= 0)
break;
buffer[ret] = '\0';
- printf("Received %d chars from server:\n%s\n", ret, buffer);
+ pc.printf("Received %d chars from server:\n%s\n", ret, buffer);
}
-
+
sock.close();
-
+
eth.disconnect();
-
+
while(1) {}
}
--- a/mbed-rtos.lib Wed May 14 15:07:26 2014 +0000 +++ b/mbed-rtos.lib Tue Oct 09 00:48:43 2018 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed-rtos/#5dfe422a963d +http://mbed.org/users/mbed_official/code/mbed-rtos/#5713cbbdb706
--- a/mbed.bld Wed May 14 15:07:26 2014 +0000 +++ b/mbed.bld Tue Oct 09 00:48:43 2018 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776 \ No newline at end of file +https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187 \ No newline at end of file
