Edison Carrick / Mbed 2 deprecated Wifi_Alarm_Sunrise_Simulator

Dependencies:   mbed

Fork of huzzah_helloWorld by ECE 4180 Team Who

Revision:
2:f01835b2e4f7
Parent:
1:e4753022f351
Child:
3:072c63f44572
diff -r e4753022f351 -r f01835b2e4f7 main.cpp
--- a/main.cpp	Fri Mar 18 05:13:25 2016 +0000
+++ b/main.cpp	Fri Mar 18 15:43:24 2016 +0000
@@ -30,7 +30,7 @@
 char val[2];
  
 char ssid[32] = "ssid";     // enter WiFi router ssid inside the quotes
-char pwd [32] = "password"; // enter WiFi router password inside the quotes
+char pwd [32] = "Password"; // enter WiFi router password inside the quotes
  
 void SendCMD(),getreply(),ESPhttp(),ESPsetbaudrate(), sendConfig(), ESPreset(), sendNTPFunction(), updateNTP(), getUtime(), startSunrise(float d);
 
@@ -67,13 +67,6 @@
  void dev_recv()
 {
     led1 = !led1;
-    /*
-    while(esp.readable()) {
-        char tmp = esp.getc();
-        data += tmp;
-        pc.putc(tmp);
-    }
-    */
     timeout=2;
     getreply();
     pc.printf("%s\n\n", buf);
@@ -126,7 +119,8 @@
     // send the NTP function to wifi module
     sendNTPFunction();
     
-    
+    rtc = time(NULL);
+    tp = localtime(&rtc);
 
     
     while(tp->tm_year ==0){
@@ -198,7 +192,7 @@
     
     
     pc.printf("\n---------- Connecting to AP ----------\r\n");
-    pc.printf("ssid = %s   pwd = %s\r\n",ssid,pwd);
+    //pc.printf("ssid = %s   pwd = %s\r\n",ssid,pwd);
     strcpy(snd, "wifi.sta.config(\"");
     strcat(snd, ssid);
     strcat(snd, "\",\"");
@@ -379,7 +373,10 @@
 
 void sendNTPFunction()
 {
-    wait(15);
+    wait(5);
+         
+    pc.printf("\n---------- Setting up NTp Client on Wifi Module ----------\r\n");
+   
     strcpy(snd, "timezone = -4\r\n");
         SendCMD();
         wait(2);