Wiflash demo program
Dependencies: EthernetInterface mbed-rtos mbed wiflash
Fork of TCPSocket_HelloWorld by
Diff: main.cpp
- Revision:
- 16:7735da154f2f
- Parent:
- 11:59dcefdda506
diff -r 69e41cbbc8ac -r 7735da154f2f main.cpp --- a/main.cpp Sun Sep 21 05:55:13 2014 +0000 +++ b/main.cpp Thu Apr 30 23:58:32 2015 +0000 @@ -1,31 +1,11 @@ #include "mbed.h" #include "EthernetInterface.h" +#include "wiflash.h" // Include our wiflash library + +Wiflash wf; // Pass in a reference to the Ethernet interface object to the Wiflash object + int main() { - EthernetInterface eth; - eth.init(); //Use DHCP - eth.connect(); - printf("IP Address is %s\n", eth.getIPAddress()); - - TCPSocketConnection sock; - sock.connect("mbed.org", 80); - - char http_cmd[] = "GET /media/uploads/mbed_official/hello.txt HTTP/1.0\n\n"; - sock.send_all(http_cmd, sizeof(http_cmd)-1); - - char buffer[300]; - int ret; - while (true) { - ret = sock.receive(buffer, sizeof(buffer)-1); - if (ret <= 0) - break; - buffer[ret] = '\0'; - printf("Received %d chars from server:\n%s\n", ret, buffer); - } - - sock.close(); - - eth.disconnect(); - - while(1) {} + wf.setUp(); + printf("Inside main!\n"); }