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.9: mbed HTTP client test 00002 */ 00003 #include "mbed.h" 00004 #include "EthernetNetIf.h" 00005 #include "HTTPClient.h" 00006 EthernetNetIf eth( 00007 IpAddr(192,168,0,101), //IP Address 00008 IpAddr(255,255,255,0), //Network Mask 00009 IpAddr(192,168,0,1), //Gateway 00010 IpAddr(192,168,0,1) //DNS 00011 ); 00012 HTTPClient http; 00013 HTTPText txt; 00014 Serial pc (USBTX,USBRX) ; 00015 int main() { 00016 pc.printf("\r\nSetting up network connection...\n\r"); 00017 eth.setup(); 00018 pc.printf("\r\nSetup OK. Queerying data...\r\n"); 00019 // attempt to access file ‘mbedclienttest.txt’ through the internet... 00020 HTTPResult r=http.get("http://www.rt60.co.uk/mbed/mbedclienttest.txt", &txt); 00021 pc.printf("Result :\n\r\"%s\"\n\r", txt.gets()); 00022 }
Generated on Thu Nov 3 2022 16:44:42 by
1.7.2