Hello JO3RI,
I am working on a project that also uses a twitter feed for controlling hardware although I am trying to also use WiFi by means of this product:
http://diysandbox.com/our-products/arduino/platinumI am having trouble however porting your code over to the wifi libraries.
Below is the modified code:
#include <SPI.h>
#include <Wirefree.h>
#include <WifiClient.h>
#include <TextFinder.h>
WIFI_PROFILE w_prof = { "R_Squared_WiFi", /* SSID */
"0123456789" , /* WPA/WPA2 passphrase */
NULL, /* Set for DHCP */
NULL, /* Set for DHCP */
NULL /* Set for DHCP */
};
String TwitterName ="EETSeniorDesign";
char tweet[140];
String SearchString ="<title>";
byte charsize;
char serverName[] = "api.twitter.com";
WifiClient client(serverName, 80);
void parseRxData(String data)
{
}
void setup()
{
// initialize serial:
Serial.begin(9600);
// start wifi
Wireless.begin(&w_prof, &parseRxData);
// connect to twitter:
delay(3000);
}
void loop()
{
Serial.println("debug - void loop()"); //debug
if (client.connect());
{
Serial.println("debug - client.connect() = true"); //debug
TextFinder finder( client,2 );
client.print("GET /1/statuses/user_timeline.rss?screen_name=");
client.print(TwitterName);
client.print("&count=1 HTTP/1.1");
client.println("HOST: api.twitter.com");
client.println();
Serial.println("debug - HTTP Request Sent"); //debug
while (client.connect())
{
Serial.println("debug - client.connect() = true"); //debug
if (client.available())
{
Serial.println("debug - client.available() = true"); //debug
SearchString = SearchString + TwitterName + ": ";
charsize = SearchString.length() + 1;
char StartHere[charsize];
char EndHere[] = "</title>";
SearchString.toCharArray(StartHere,charsize);
if((finder.find("<item>")&&(finder.getString(StartHere,EndHere,tweet,140)!=0)))
Serial.println(tweet);
break;
}
else
{
Serial.println("debug - client.available() = false"); //debug
}
}
delay(1);
client.stop();
Serial.println("debug - client.stop()"); //debug
}
delay(60000);
Serial.println("debug - delay (600000)"); //debug
}
This is the response I get from the serial output:
AT+WWPA=0123456789
AT+WA=R_Squared_WiFi
AT+NDHCP=1
debug - void loop()
AT+NCTCP=api.twitter.com,80
debug - client.connect() = true
debug - HTTP Request Sent
AT+NCTCP=api.twitter.com,80
debug - client.stop()
debug - delay (600000)
Would you or anyone else have any suggestions?