
Demo Program 2 for Wiflash
Dependencies: EthernetInterface mbed-rtos mbed wiflash2
Fork of TCPSocket_HelloWorld by
Diff: main.cpp
- Revision:
- 16:b2b0fa8c2f0b
- Parent:
- 11:59dcefdda506
--- a/main.cpp Sun Sep 21 05:55:13 2014 +0000 +++ b/main.cpp Fri May 01 15:04:47 2015 +0000 @@ -1,31 +1,32 @@ #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 +DigitalOut myled(LED1); +DigitalOut myled1(LED2); +DigitalOut myled2(LED3); +DigitalOut myled3(LED4); 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); + wf.setUp(); + printf("Inside main!\n"); + while(1) { + myled = 1; + wait(0.4); + myled1 = 1; + wait(0.4); + myled2 = 1; + wait(0.4); + myled3 = 1; + wait(0.4); + myled3 = 0; + wait(0.4); + myled2 = 0; + wait(0.4); + myled1 = 0; + wait(0.4); + myled = 0; + wait(0.4); } - - sock.close(); - - eth.disconnect(); - - while(1) {} }