Go Down

Topic: Twitter and duplicate post fix? (Read 516 times) previous topic - next topic

0miker0


I have two way communication working on my Arduino with ethernet shield. Right now with each button press it tweets that a button has been press x many times, turn on LED? If a tweet a Yes the LED turns on and a No turns it off. If a Yes does not work then two duplicate posts in a row will not work.  A time stamp or random number after each Yes or No is possible but ugly. Is there another way?
I found the bit of code below that I am NOT currently using because i'm not sure what it does or if it is a possible fix for my problem. No idea what the "status == 200)" does.


if (twitter.post(buffer)) {
    int status = twitter.wait();
    if (status == 200) {
      Serial.println("OK.");
    } else {
      Serial.print("failed : code ");
      Serial.println(status);
    }
  } else {
    Serial.println("connection failed.");
  }

PaulS

Quote
No idea what the "status == 200)" does.

Every HTTP transaction returns a status code. 200 is success in HTTP terms. This code is testing that the last post was successful. If so, it sends one message to the serial port. If not, it sends another.

It does nothing to ensure that the post WILL BE successful.

Quote
Right now with each button press it tweets that a button has been press x many times, turn on LED?

Why would anyone else in the world care?


0miker0

Each twitter post is set up to text my cell phone so I use it now as a remote monitor with the ability to turn on and off I/O pins with my cell. No one cares to read these twitter posts but me. It could be connected to a motion sensor with the ability to turn on an alarm, monitor the temperature of something with the ability to remotely shut it down if it gets too hot. Many possibilities...

PaulS

Quote
Many possibilities...

Sure there are. But 99.999% of them are of interest to you, and only you. That is not what Twitter is for. If you expect to abuse a free service, you need to play by their rules.

Otherwise, spend the $10 a month for your own web site that you can post freely to.

dxw00d

To be fair, it's probably as interesting as anything else on Twitter.

Go Up