Go Down

Topic: Arduino Twitter Still a Viable Option? (Read 99 times) previous topic - next topic

AidanArduinoGuy

I am trying to have my Arduino read the room temperature of my classroom and post it periodically to twitter. I'm using a modified version of the code used on various parts of the internet that is modified for use with the wifi shield. However, I cannot successfully post to twitter, despite getting a code 200, which is supposed to indicate a success. I am wondering if perhaps the Twitter API is no longer compatible with Arduino or if I'm just doing something wrong. I took out my token and wifi information for obvious security reasons.


#include <SPI.h> // needed in Arduino 0019 or later
#include <WiFi.h>
#include <Twitter.h>


char ssid[] = "MyNetwork";  //  your network SSID (name)
char pass[] = "MySSID";  // your network password

// Your Token to Tweet (get it from http://arduino-tweet.appspot.com/)
Twitter twitter("");

// Message to post
char msg[] = "This is a test!!!";

void setup()
{
  delay(1000);
  WiFi.begin(ssid,pass);
  // or you can use DHCP for automatic IP address configuration.
  // WiFi.begin(mac);
  delay(5000);
  Serial.begin(9600);
 
  Serial.println("connecting ...");
  if (twitter.post(msg)) {
    // Specify &Serial to output received response to Serial.
    // If no output is required, you can just omit the argument, e.g.
    // int status = twitter.wait();
    int status = twitter.wait(&Serial);
    if (status == 200) {
      Serial.println("OK.");
    } else {
      Serial.print("failed : code ");
      Serial.println(status);
    }
  } else {
    Serial.println("connection failed.");
  }
}

void loop()
{
}

johnwasser

Does the SimplePost example that comes with the library work?

The example seems to be using Ethernet.  Are you sure the Twitter library supports WiFi?
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

chummer1010

If this doesn't work, you can download Blynk on your phone and use the Tweet widget.
#include <signature.h>

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy