Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of TwitterProjekat by
Revision 2:907b2a247aaa, committed 2016-05-26
- Comitter:
- 2016US_BenjaminRamic
- Date:
- Thu May 26 19:18:22 2016 +0000
- Parent:
- 1:51391e2303d7
- Commit message:
- Ahmed Popovi?; Benjamin Rami?; Projekat US
Changed in this revision
--- a/Twitter.h	Fri May 20 16:07:30 2016 +0000
+++ b/Twitter.h	Thu May 26 19:18:22 2016 +0000
@@ -26,9 +26,9 @@
         {
             char c;
             pc->scanf("%c", &c);
-            if(c == '\n')
+            if(c == '\n' || c == '\r')
             {
-                poruka[i+1] = '\0';
+                poruka[i] = '\0';
                 break;
             }
             
--- a/WiFi.h	Fri May 20 16:07:30 2016 +0000
+++ b/WiFi.h	Thu May 26 19:18:22 2016 +0000
@@ -1,5 +1,6 @@
 #include "ESP8266.h"
 #include <string>
+#include <cstdlib>
 
 using namespace std;
 
@@ -29,23 +30,35 @@
         esp->RcvReply(rcv, 400);
         pc->printf("%s", rcv);
         
+        char velChar[10];
+        int ukupnaVelicina = 4 + kveri.length() + 35;
         wait(2);
-        strcpy(snd, "AT+CIPSEND=0,39");
+        strcpy(snd, "AT+CIPSEND=0,");
+        sprintf(velChar, "%d", ukupnaVelicina);
+        strcpy(snd+13, velChar);
+        //pc->printf("sad saljem: %s\r\n\r\n", snd);
         esp->SendCMD(snd);
         esp->RcvReply(rcv, 2048);
-        pc->printf("%s", rcv);
+        //pc->printf("%s", rcv);
         wait(2);
         
         
         strcpy(snd, "GET ");
         strcpy(snd + 4, kveri.c_str());
-        strcpy(snd + 4 + kveri.length(), " HTTP/1.1\r\nHost: liliumdev.com\r\n\r\n");
+        strcpy(snd + 4 + kveri.length(), " HTTP/1.1\r\nHost: liliumdev.com\r\n\r\n\0");
+        string stringSndBuffer = snd;
+        
+       /* pc->printf("U bufferu je: \"");
+        pc->printf("%s", snd); 
+        pc->printf("\", velicina svega je: %d, a nasa je %d\r\n", snd, stringSndBuffer.length(), ukupnaVelicina);*/
         esp->SendCMD(snd);
-        while(true)
+       /* while(true)
         {
             esp->RcvReply(rcv, 2048);
             pc->printf("%s", rcv);   
-        }
+        }*/
+        
+        return "";
     }        
         
     bool SetupModule()
--- a/main.cpp	Fri May 20 16:07:30 2016 +0000
+++ b/main.cpp	Thu May 26 19:18:22 2016 +0000
@@ -16,11 +16,12 @@
        
     while(1)
     {
-        printf("Unesite poruku: (max 140 karaktera)");
+        pc.printf("Unesite poruku: (max 140 karaktera): ");
         
         tvit.unesiPoruku();
         string kveri("/tvitmanijak/?q=" + tvit.urlEncode(tvit.dajPoruku()));
         wifi.GetPage(kveri);
+        pc.printf("\r\nTwitao!\r\n");
         wait(2);
     }
 }
    