void setup() { ebox_init(); uart1.begin(9600); w5500.begin(2,mac,lip,sub,gw); attach_eth_to_socket(&w5500); w5500.getMAC (ip); uart1.printf("mac : %02x.%02x.%02x.%02x.%02x.%02x\r\n", ip[0],ip[1],ip[2],ip[3],ip[4],ip[5]); w5500.getIP (ip); uart1.printf("IP : %d.%d.%d.%d\r\n", ip[0],ip[1],ip[2],ip[3]); w5500.getSubnet(ip); uart1.printf("mask : %d.%d.%d.%d\r\n", ip[0],ip[1],ip[2],ip[3]); w5500.getGateway(ip); uart1.printf("GW : %d.%d.%d.%d\r\n", ip[0],ip[1],ip[2],ip[3]); uart1.printf("Network is ready.\r\n"); tcp.begin(SOCKET7,3000); tcp.connect(rip,8080); }
void setup() { ebox_init(); uart1.begin(115200); ret = sizeof(long); ret = sizeof(int); ret = sizeof(short int); ret = sizeof(short); w5500.begin(2,mac,ip,sub,gw,dns); attach_eth_to_socket(&w5500); w5500.getMAC (buf); uart1.printf("mac : %02x.%02x.%02x.%02x.%02x.%02x\r\n", buf[0],buf[1],buf[2],buf[3],buf[4],buf[5]); w5500.getIP (buf); uart1.printf("IP : %d.%d.%d.%d\r\n", buf[0],buf[1],buf[2],buf[3]); w5500.getSubnet(buf); uart1.printf("mask : %d.%d.%d.%d\r\n", buf[0],buf[1],buf[2],buf[3]); w5500.getGateway(buf); uart1.printf("GW : %d.%d.%d.%d\r\n", buf[0],buf[1],buf[2],buf[3]); uart1.printf("Network is ready.\r\n"); ddns.begin(SOCKET1,3000); ret = ddns.query(name); if(ret == DNS_RET_SUCCESS) /*发送DNS请求*/ uart1.printf("Get [%s]'s IP address [%d.%d.%d.%d] from %d.%d.%d.%d\r\n",name,ddns.domain_ip[0],ddns.domain_ip[1],ddns.domain_ip[2],ddns.domain_ip[3],dns[0],dns[1],dns[2],dns[3]); else if(ret == DNS_RET_FAIL) uart1.printf("获取超时\r\n"); else uart1.printf("未知错误.\r\n"); }
void setup() { ebox_init(); uart1.begin(115200); uart1.printf("\r\nuart1 9600 ok!"); w5500.begin(2, mac, lip, sub, gw, dns); attach_eth_to_socket(&w5500); w5500.getMAC (ip); uart1.printf("\r\nmac : %02x.%02x.%02x.%02x.%02x.%02x\r\n", ip[0], ip[1], ip[2], ip[3], ip[4], ip[5]); w5500.getIP (ip); uart1.printf("IP : %d.%d.%d.%d\r\n", ip[0], ip[1], ip[2], ip[3]); w5500.getSubnet(ip); uart1.printf("mask : %d.%d.%d.%d\r\n", ip[0], ip[1], ip[2], ip[3]); w5500.getGateway(ip); uart1.printf("GW : %d.%d.%d.%d\r\n", ip[0], ip[1], ip[2], ip[3]); uart1.printf("Network is ready.\r\n"); if(udp1.begin(0, 30000) == 0) uart1.printf("\r\nudp1 server creat ok! listen on 30000"); if(udp2.begin(1, 30001) == 0) uart1.printf("\r\nudp2 server creat ok! listen on 30001"); }