Demo Program 2 for Wiflash

Dependencies:   EthernetInterface mbed-rtos mbed wiflash2

Fork of TCPSocket_HelloWorld by mbed official

Files at this revision

API Documentation at this revision

Comitter:
adhithyan15
Date:
Fri May 01 15:04:47 2015 +0000
Parent:
15:69e41cbbc8ac
Commit message:
Initial Commit

Changed in this revision

EthernetInterface.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
wiflash.lib Show annotated file Show diff for this revision Revisions of this file
--- a/EthernetInterface.lib	Sun Sep 21 05:55:13 2014 +0000
+++ b/EthernetInterface.lib	Fri May 01 15:04:47 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/EthernetInterface/#5887ae6c0c2c
+http://mbed.org/users/mbed_official/code/EthernetInterface/#2fc406e2553f
--- 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) {}
 }
--- a/mbed-rtos.lib	Sun Sep 21 05:55:13 2014 +0000
+++ b/mbed-rtos.lib	Fri May 01 15:04:47 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed-rtos/#631c0f1008c3
+http://mbed.org/users/mbed_official/code/mbed-rtos/#34292fba723c
--- a/mbed.bld	Sun Sep 21 05:55:13 2014 +0000
+++ b/mbed.bld	Fri May 01 15:04:47 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/433970e64889
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wiflash.lib	Fri May 01 15:04:47 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/adhithyan15/code/wiflash2/#30192d068543