Example program for the LWIPInterface
Dependencies: LWIPInterface NetworkSocketAPI mbed-rtos mbed
Fork of HelloESP8266Interface by
Example for the NetworkSocketAPI. Attempts to get the device's public facing IP address from ifcfg.me.
Diff: main.cpp
- Revision:
- 58:7033f5893210
- Parent:
- 57:fb2f8e188383
- Child:
- 59:14d6716bc772
--- a/main.cpp Tue Apr 05 19:22:52 2016 +0000 +++ b/main.cpp Tue Apr 05 15:32:00 2016 -0500 @@ -23,25 +23,24 @@ { myled = !myled; } -/* + LWIPInterface eth; -TCPSocket socket(ð);*/ +TCPSocket socket(ð); int main() { Ticker t; t.attach(flash, 0.4f); printf("NetworkSocketAPI Example\r\n"); -/* + eth.connect(); - const char *ip = eth.getIPAddress(); - const char *mac = eth.getMACAddress(); + const char *ip = eth.get_ip_address(); + const char *mac = eth.get_mac_address(); printf("IP Address is: %s\r\n", (ip) ? ip : "No IP"); printf("MAC Address is: %s\r\n", (mac) ? mac : "No MAC"); - socket.open("time-a.nist.gov", 37); - printf("time-a.nist.gov resolved to: %s\r\n", socket.getIPAddress()); + socket.connect("time-a.nist.gov", 37); char recieved[100] = {0}; int32_t size = 0; @@ -52,5 +51,5 @@ printf("Recieved: %ld bytes, %02x%02x%02x%02x\r\n", size, recieved[0], recieved[1], recieved[2], recieved[3]); - printf("NetworkSocketAPI Example Finished\r\n");*/ + printf("NetworkSocketAPI Example Finished\r\n"); }