For lecture
Dependencies: WIZnetInterface WIZwiki-W7500-lecture mbed
Fork of WIZwiki-W7500-lecture2-udp by
main.cpp
00001 #include "mbed.h" 00002 #include "DNSClient.h" 00003 #include "EthernetInterface.h" 00004 00005 int main() { 00006 00007 EthernetInterface eth; 00008 00009 uint8_t mac_addr[6] = {0x00, 0x08, 0xDC, 0xFF, 0xFF, 0xFF}; 00010 eth.init(mac_addr, "222.98.173.239", "255.255.255.192", "222.98.173.254"); // USE Static IP 00011 //eth.init(mac_addr); //Use DHCP 00012 eth.connect(); 00013 00014 printf("IP Address is %s\r\n", eth.getIPAddress()); 00015 00016 DNSClient client; 00017 00018 client.lookup("openweathermap.org"); 00019 printf("http://openweathermap.org/ ip address: %d.%d.%d.%d\r\n",(client.ip&0xff000000)>>24,(client.ip&0x00ff0000)>>16,(client.ip&0x0000ff00)>>8,(client.ip&0x000000ff)>>0); 00020 eth.disconnect(); 00021 00022 printf("Disconnected!"); 00023 }
Generated on Sun Jul 17 2022 01:58:44 by 1.7.2