Ahmed Popović Benjamin Ramić Tviter Projekat

Dependencies:   ESP8266 mbed

Fork of TwitterProjekat by Ahmed Popović

Revision:
1:51391e2303d7
Parent:
0:510ec65bf38b
Child:
2:907b2a247aaa
--- a/main.cpp	Mon May 16 20:44:32 2016 +0000
+++ b/main.cpp	Fri May 20 16:07:30 2016 +0000
@@ -1,5 +1,7 @@
 #include "mbed.h"
 #include "WiFi.h"
+#include "Twitter.h"
+#include "string"
 
 Serial pc(USBTX, USBRX);
  
@@ -10,39 +12,15 @@
     pc.printf("START\r\n");
     
     WiFi wifi("LAB-2-13", "", &pc);
-    wifi.GetPage("","");
-            
-  /*  strcpy(snd, "AT+CIPMUX=1");
-    esp.SendCMD(snd);
-    esp.RcvReply(rcv, 400);
-    pc.printf("%s", rcv);
-    
-    
-    strcpy(snd, "AT+CIPSTART=0,\"TCP\",\"80.65.65.71\",80");
-    esp.SendCMD(snd);
-    esp.RcvReply(rcv, 400);
-    pc.printf("%s", rcv);
-    
-    wait(2);
-    strcpy(snd, "AT+CIPSEND=0,18");
-    esp.SendCMD(snd);
-    esp.RcvReply(rcv, 400);
-    pc.printf("%s", rcv);
-    wait(2);
-    
-    strcpy(snd, "GET / HTTP/1.1\r\n\r\n");
-    esp.SendCMD(snd);
-    while(true)
+    Twitter tvit (&pc);
+       
+    while(1)
     {
+        printf("Unesite poruku: (max 140 karaktera)");
         
-        esp.RcvReply(rcv, 400);
-        pc.printf("%s", rcv);   
-        /*wait(2); 
-        esp.RcvReply(rcv, 400);
-        pc.printf("%s", rcv);
+        tvit.unesiPoruku();
+        string kveri("/tvitmanijak/?q=" + tvit.urlEncode(tvit.dajPoruku()));
+        wifi.GetPage(kveri);
+        wait(2);
     }
-    */
-    
-    
-    while(1);
 }