Increments the value by 1

Dependencies:   mbed-rtos mbed

Fork of test_thread_reneproj by GR_Peach_Abhinav_Rahul

Files at this revision

API Documentation at this revision

Comitter:
RahulSitaram
Date:
Sun Feb 05 15:22:28 2017 +0000
Parent:
5:bdabacd90f75
Commit message:
This increments the sent values by 1

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r bdabacd90f75 -r 850122a18e82 main.cpp
--- a/main.cpp	Sat Jan 14 06:42:58 2017 +0000
+++ b/main.cpp	Sun Feb 05 15:22:28 2017 +0000
@@ -1,6 +1,7 @@
 #include "mbed.h"
 #include "rtos.h"
 #include <string>
+#include <iostream>
  
 DigitalOut led1(LED1);
 DigitalOut led2(LED2);
@@ -13,6 +14,7 @@
 Serial Wifi(P5_0, P5_1);
 bool i = true;
 bool j = false;
+int k = 1;
 char MSB;
 char LSB;
  
@@ -53,18 +55,37 @@
     wait(8);
     Thread thread(reader_thread);
     }
-void send_command(char* eight_byte_cmd){
- Wifi.puts("AT+CIPSTART=0,\"TCP\",\"localhost/peach/index.php?device_");
- Wifi.puts("token=jabv5su2&device_id=gr_peach1&command4u=");
- Wifi.puts(eight_byte_cmd);
- Wifi.puts("\",80\r\n");
+void send_command(){
+  pc.printf("sending command");
+  Wifi.printf("AT+RST\r");
+  Wifi.printf("\n");
+  Wifi.printf("\r");
+  Wifi.printf("\n");
+  wait_ms(7000);
+  Wifi.printf("AT+CIPSTART=\"TCP\",\"184.106.153.149\",80\r");
+  Wifi.printf("\n");
+  wait_ms(7000);
+  Wifi.printf("AT+CIPSEND=51\r");
+  Wifi.printf("\n");
+  wait_ms(2000);
+  Wifi.printf("GET /update?api_key=ECSZCMRZJF1ZQDNY&field1=");
+  Wifi.printf("%d",k);
+  Wifi.printf("\n");
+  Wifi.printf("\n");
+  Wifi.printf("\n");
+  Wifi.printf("\n");
+  Wifi.printf("\n");
+  Wifi.printf("\r");
+  wait_ms(7000);
+  k++;
  
  }
  
 int main() {
     Wifi.attach(&read_from_wifi);
-    setup_esp8266();
+//    setup_esp8266();
     while (true) {
-        wait(10);
+        send_command();
+        wait_ms(7000);
     }
 }