Suga koubou / Mbed 2 deprecated TinyResolver

Dependencies:   EthernetNetIf mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "EthernetNetIf.h"
00003 #include "TinyResolver.h"
00004 
00005 DigitalOut myled(LED1);
00006 Serial pc(USBTX, USBRX);
00007 EthernetNetIf eth; 
00008 
00009 int main () {
00010     EthernetErr ethErr;
00011     uint32_t addr;
00012 
00013     myled = 1;
00014 
00015     ethErr = eth.setup();
00016     if(ethErr) {
00017         return -1;
00018     }
00019 
00020     getHostByName(IpAddr(192,168,1,1), "mbed.org", &addr);
00021 
00022     printf("IP address: %d.%d.%d.%d\r\n", (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff);
00023 
00024     myled = 0;
00025     return 0;
00026 }