Strange Problem | Arduino | Forum


Please consider registering


— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 3 characters - maximum search word length is 84 characters

Register Lost password?
sp_Feed sp_TopicIcon
Strange Problem
New Member
Forum Posts: 2
sp_UserOfflineSmall Offline
July 22, 2011 - 5:48 pm
sp_Permalink sp_Print

I've run into a strange problem involving trying to integrate the thingsTweet app into my program. The arduino basic example seems to work well when using one analoge input to update a graph.


I tried adding the updateTwitterStatus function into the mix (yes I've defined the thingsTweet api variable) and it consistently gives me a 400 bad request. I'm not even calling the function yet from the loop. Simply having the function in my sketch causes the 400 bad request. The sketch compiles fine with no errors. Here's the function:


void updateTwitterStatus(String msg)


if (client.connect() && msg.length() > 0)  {     // Create HTTP POST Data    

msg = "api_key="+thingtweetAPIKey+"&status="+msg;        Serial.println("Connected to ThingTweet...");    Serial.println();            client.print("POST /apps/thingtweet/1/statuses/update HTTP/1.1\n");    client.print("Host:\n");

client.print("Connection: close\n");

client.print("Content-Type: application/x-www-form-urlencoded\n");    client.print("Content-Length: ");    




}  else  {    

Serial.println("Connection Failed.");     





While trying to debug this problem I removed the client.print commands from this function but left everything else in and then the sketch started working properly. If I left even just one line of client.print in the updateTwitterStatus function the sketch fails. I also tried creating a new instance of client called clientTwitter leaving client for the  updateThingSpeak function. Still caused problems.


I'm kind of stumped here. Is this an arduino ethernet library bug or is it a thingspeak problem?

Natick, MA

Forum Posts: 390
sp_UserOfflineSmall Offline
July 22, 2011 - 6:19 pm
sp_Permalink sp_Print

This does not solve the imediat issue, but you can post and Tweet at the same time if you want.

example: field1=6&twitter=(twitter username linked with ThingTweet)&tweet=(your tweet)

You would only want to do this occasionally and not with every insert to your ThingSpeak channel. Twitter would rate limit you.

We will check into the other sketch. Can you send us the PDE your using?

Natick, MA

Forum Posts: 390
sp_UserOfflineSmall Offline
July 24, 2011 - 1:00 am
sp_Permalink sp_Print sp_EditHistory

I have written a new Arduino sketch that combines the Thing Channel update and ThingTweet sketch into one.

You can download it here:

Try this and see if this works for you and your situation.

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
19 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 252

Vinod: 164

cstapels: 96

piajola: 75

vespapierre: 63

Adarsh_Murthy: 59

Newest Members:







Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565


Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Administrators: Hans, lee