Updated twitter client

This commit is contained in:
Tom Igoe 2012-03-15 13:52:17 -04:00
parent 01a0e7e3de
commit 51d7a56ae2
1 changed files with 8 additions and 8 deletions

View File

@ -13,7 +13,7 @@
Circuit: Circuit:
* WiFi shield attached to pins 10, 11, 12, 13 * WiFi shield attached to pins 10, 11, 12, 13
created 13 Mar 2012 created 15 Mar 2012
by Tom Igoe by Tom Igoe
This code is in the public domain. This code is in the public domain.
@ -22,8 +22,8 @@
#include <SPI.h> #include <SPI.h>
#include <WiFi.h> #include <WiFi.h>
//char ssid[] = "YourNetwork"; // your network SSID (name) char ssid[] = "YourNetwork"; // your network SSID (name)
//char pass[] = "password"; // your network password (use for WPA, or use as key for WEP) char pass[] = "password"; // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0; // your network key Index number (needed only for WEP) int keyIndex = 0; // your network key Index number (needed only for WEP)
int status = WL_IDLE_STATUS; // status of the wifi connection int status = WL_IDLE_STATUS; // status of the wifi connection
@ -35,8 +35,8 @@ const unsigned long requestInterval = 30*1000; // delay between requests; 30
// if you don't want to use DNS (and reduce your sketch size) // if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server: // use the numeric IP instead of the name for the server:
IPAddress server(199,59,149,200); // numeric IP for api.twitter.com //IPAddress server(199,59,149,200); // numeric IP for api.twitter.com
//char server[] = "api.twitter.com"; // name address for twitter API char server[] = "api.twitter.com"; // name address for twitter API
boolean requested; // whether you've made a request since connecting boolean requested; // whether you've made a request since connecting
unsigned long lastAttemptTime = 0; // last time you connected to the server, in milliseconds unsigned long lastAttemptTime = 0; // last time you connected to the server, in milliseconds
@ -52,8 +52,6 @@ void setup() {
// initialize serial: // initialize serial:
Serial.begin(9600); Serial.begin(9600);
Serial.println("Attempting to connect to WPA network..."); Serial.println("Attempting to connect to WPA network...");
Serial.print("SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid, pass); status = WiFi.begin(ssid, pass);
if ( status != WL_CONNECTED) { if ( status != WL_CONNECTED) {
@ -87,6 +85,8 @@ void loop()
// tweet is beginning. Clear the tweet string: // tweet is beginning. Clear the tweet string:
readingTweet = true; readingTweet = true;
tweet = ""; tweet = "";
// break out of the loop so this character isn't added to the tweet:
return;
} }
// if you're currently reading the bytes of a tweet, // if you're currently reading the bytes of a tweet,
// add them to the tweet String: // add them to the tweet String: