hey i have a similar problem but i can't display on 16X2 LCD this is my code
can u see where i went wrong please.. i only want to display the tweet on my LCD
Thanks
#include <SPI.h>
#include <Ethernet.h>
#include <LiquidCrystal.h>
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x0A, 0xA0 };
IPAddress ip(152,62,89,135);
EthernetClient client;
const unsigned long requestInterval = 100000; // delay between requests
char serverName[] = "api.twitter.com"; // twitter URL
boolean requested; // whether you've made a request since connecting
unsigned long lastAttemptTime = 0; // last time you connected to the server, in milliseconds
String currentLine = ""; // string to hold the text from server
String tweet = ""; // string to hold the tweet
boolean readingTweet = false; // if you're currently reading the tweet
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
{
lcd.begin(16, 2);
currentLine.reserve(256);
tweet.reserve(150);
Serial.begin(9600);
Serial.println("Attempting to get an IP address using DHCP:");
if (!Ethernet.begin(mac))
{
Serial.println("failed to get an IP address using DHCP, trying manually");
Ethernet.begin(mac, ip);
}
Serial.print("My address:");
Serial.println(Ethernet.localIP());
connectToServer();
}
void loop()
{
if (client.connected())
{
if (client.available())
{
char inChar = client.read();
currentLine += inChar;
if (inChar == '\n')
{
currentLine = "";
}
if ( currentLine.endsWith(""))
{
readingTweet = true;
tweet = "";
}
if (readingTweet)
{
if (inChar != '<')
{
tweet += inChar;
}
else
{
readingTweet = false;
lcd.print(tweet);
Serial.println(tweet);
client.stop();
}
}
}
}
else if (millis() - lastAttemptTime > requestInterval)
{
connectToServer();
}
}
void connectToServer()
{
Serial.println("connecting to server...");
if (client.connect(serverName, 80))
{
Serial.println("making HTTP request...");
client.println("GET /1/statuses/user_timeline.xml?screen_name=KomalMaisuria&count=1 HTTP/1.1");
client.println("HOST: api.twitter.com");
client.println();
}
lastAttemptTime = millis();
}