ittraining_project_2016 / ESP8266_Test_WIFI

Dependencies:   ESP8266Interface

Dependents:   Nucleo_i2c_OLED_BME280_copy

Fork of ESP8266_Test by ESP8266

Revision:
15:d253bb6ebccc
Parent:
13:7959d8fb9c39
--- a/main.cpp	Fri Jun 24 03:47:28 2016 +0000
+++ b/main.cpp	Tue Jun 28 03:35:07 2016 +0000
@@ -7,10 +7,10 @@
 
 DigitalOut led1(LED1);
 
-const char* TEST_SERVER_ADDRESS = "192.168.2.65";
-const int TEST_SERVER_PORT = 8889;
+const char* TEST_SERVER_ADDRESS = "192.168.2.87";
+const int TEST_SERVER_PORT = 7777;
 
-ESP8266Interface wifi(PA_11, PA_12, D0, "ittraining402","itstudent",115200); // tx, rx 
+ESP8266Interface wifi(PA_11, PA_12, D0, "Pi_AP","pi123456"); // tx, rx 
 
 
 // For monitoring data from ESP8266
@@ -30,6 +30,8 @@
 
 int main()
 {
+    
+        
     // LED Blink
     for (int i=0; i<5; i++) {
         led1 = 1;
@@ -51,15 +53,21 @@
         return 0;
     }
 
+
+ 
     TCPSocketConnection socket;
     while (socket.connect(TEST_SERVER_ADDRESS, TEST_SERVER_PORT) < 0) {
         pc.printf("Unable to connect to (%s) on port (%d)\n", TEST_SERVER_ADDRESS, TEST_SERVER_PORT);
         wait(1);
     }
-
-    char hello[] = "Hello World\r\n";
-    socket.send_all(hello, sizeof(hello) - 1);
+    
+    char rev[1024] = {0};
+    char hello[] = "Hello Man\r\n";
+    socket.send_all(hello, sizeof(hello)-1);
+    socket.receive(rev, 1024);
+    pc.printf("%s\r\n", rev);
+    
     socket.close();
 
-    while(true) {}
+    return 0;
 }