# Problems posting to Twitter

**URL:** <https://forum.arduino.cc/t/problems-posting-to-twitter/48911>\
**Category:** Troubleshooting\
**Created:** [June 25, 2010, 8:02pm UTC](https://forum.arduino.cc/t/problems-posting-to-twitter/48911 "2010-06-25T20:02:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [June 25, 2010, 8:02pm UTC](https://forum.arduino.cc/t/problems-posting-to-twitter/48911/1 "2010-06-25T20:02:42Z")

</div>

I've been struggling with incorporating Twitter into my project. It will tweet only once, and always spits out an error from the TwitterLibrary. I tried implementing the solution from this post: [http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1268620065/3](http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1268620065/3), but honestly I'm not satisfied with it. It tweets a random number at the end of each post, so each is unique. Its not desirable for it to post the random number and it still doesn't work entirely. My code has two conditionals: tweet one message given one condition is satisfied and tweet another message if the other is satisfied. Both messages tweet successfully (regardless of the code errors from the TwitterLibrary), but the same message can't be tweeted consecutively, they must alternate in order to be tweeted.

Here is my code: [http://www.paulnshapiro.com/files/arduino/knocker\_twitter\_fix\_combined.pde](http://www.paulnshapiro.com/files/arduino/knocker_twitter_fix_combined.pde)

I'm hoping someone can a) fix the code that includes the random number in the tweets so it can post the same message consecutively, and/or b) give me an alternate solution to the problem without the random numbers. I would be satisfied with either, with a preference for the latter.

a pre-mature thank you to anyone who helps,

Paul

---

<div class="post-metadata">

**Author:** ![weirdo557](https://avatars.discourse-cdn.com/v4/letter/w/6de8d8/32.png) [@weirdo557](https://forum.arduino.cc/u/weirdo557)\
**Post date:** [June 25, 2010, 8:35pm UTC](https://forum.arduino.cc/t/problems-posting-to-twitter/48911/2 "2010-06-25T20:35:20Z")

</div>

sprintf(S, "%s %i",msg, randomValue); //

try changing that to

sprintf(S, "%s %i",msg); //

that will probably get rid of the random number, but im not familiar enough with the library to help with the other problems

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [June 25, 2010, 9:17pm UTC](https://forum.arduino.cc/t/problems-posting-to-twitter/48911/3 "2010-06-25T21:17:29Z")

</div>

Nope. Same problem. Won't post the same message consecutively, it must alternate. The tweet looks like "Access has been granted! You may enter. 25409"

---

<div class="post-metadata">

**Author:** ![Coding\_Badly](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@Coding\_Badly](https://forum.arduino.cc/u/Coding_Badly)\
**Post date:** [June 26, 2010, 1:33am UTC](https://forum.arduino.cc/t/problems-posting-to-twitter/48911/4 "2010-06-26T01:33:11Z")

</div>

> but the same message can't be tweeted consecutively, they must alternate in order to be tweeted

It's my understanding that Twitter suppresses duplicate successive messages. That's why the random number was added to the message.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 8:19pm UTC](https://forum.arduino.cc/t/problems-posting-to-twitter/48911/5 "2021-05-06T20:19:04Z")

</div>

Closed on May 6, 2021, 8:19pm UTC


