Made my own TwitterClient and I think it's better than the example one

sorry have been busy with work and all. yup i found out the problem. i initialized the LCD at the start of the program but forgot to change all the serial print to LCD print instead.

Could i ask why didnt you implement DHCP? I have a library that i grabbed off the net but i'm not too sure how to implement it. Could you possibly point me in the right direction? cheers!

Could i ask why didnt you implement DHCP?

Well:

  • using dhcp makes your code bigger when you upload the sketch
  • sometimes it doesn't pick up an IP
  • this way you know exactly what ip, subnet, gateway and DNS you are using

But:

  • if you want, you can just erase this:
byte ip[] =  { 192,168,1,20}; //change this
byte subnet[] = {255,255,255,0}; //change this
byte gateway[] = {192,168,0,1}; //change this
byte dns[] = {192,168,0,1}; //change this

and replace this:

Ethernet.begin(mac, ip, dns, gateway, subnet);

with this:

Ethernet.begin(mac);

Arduino IDE will then auto include dhcp and your Arduino will use dhcp when started (or it should)

brilliant! got it working but i'm stuck with cut-off tweets. i believe you create your program so that the tweets will be in a string form and sent to the microcontroller as arrays. how do i split the tweet into half so that i can display a certain amount of characters in a line and point the next string to the second line?

eg(point tweet to line):

lcd.setCursor(0, 0); //where first number is column number and second is line number

lcd.print("Tweet line 1"); 

lcd.setCursor(0, 1);

lcd.print("Tweet line 2");

cheers!

Hi kenneth87,

I could just give you the code, but what is the fun in that. Arduino is about learning and discovering :wink:
So what you need to learn more about is this:

you'll have to copy every part (piece by piece) from the char to an other char, by doing something like:

string1[0] = tweet[0]

now if you replace the 0 by i and let it repeat for let's say 70 times

for (byte i = 0; i < 71; i++){
string1[i] = tweet[i];
}

and you'll have to empty those chars every time before copying them, by doing something like:

memset (strin1,0,sizeof(string1));

at some point, you'll have to do that for "char tweet" too.

don't forget you'll need something like char string1[71] and char string2[71] before void setup().

So may I also ask, to submit any further questions on coding in the appropriate forum sections, because those or not directly related with this project.

Good luck using Arduino and Twitter.

Kenneth87,

I might have overlooked something. When the tweet gets pulled and is been put into a char, it will stay in there. So the next time if it pulls a shorter tweet, the old one will partly stay in there too. So extualy the char should be cleared before filling it.

good day,

I realised once i run the code, when i update twitter while the code is running, it will not get updated to the latest tweet.

edit: got a fix to it! do you want me to share the code i have when i'm done? also fixed the part with the tweets broken into 16chars per line in a string like what you suggested.

I did see your previous post, but I didn't had the time to answer yet. Very nice you solved this yourself.

I would love to see your code, but you should get some credit yourself. Make a new post, showing off your own project (try to include a youtube movie or some pictures), just make a quick reference to this post, explaining you started using this code and adapted it, for you own project.

Good day JO3RI,

I am able to post the code soon as it is due for submission by start november. also my twitter client stopped working due to the recent API updates. do you have any idea what changes i have to make to enable it to start working again?

Twitter api version changed from v1.0 to v1.1

bump

When I past this in my browser:

http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=JO3RI&count=1%20HTTP/1.1

replace JO3RI with your own twitter name if you like.

and if I try the same thing with hashtag search,

http://search.twitter.com/search.atom?q=%23arduino

I still get to see the last tweets, so mine is still working

yup mine is working too but when you use a code on Arduino IDE that uses GET HTTP, it doesn't seem to get tweets off twitter with that exact same line. any ideas?

also is there a way to implement oauth without going thru a PHP server?

I would give Arduino IDE 1.0 a try, the newer version seems to have other issues with my code (like dns)

i'm on arduino IDE 1.0! tested your code a while back. i could receive a weather update via xml but can't receive tweet updates via the same thing.

And you didn't change a thing? That's strange indeed. I could test your code on my own Arduino and network if you'd like.

Just attach your code to a reply and I'll give it a try. If it works on my end, you might have network issues. OR you might have set the interval to low so your Arduino is asking for updates way to fast and your IP got banned.

Could you please help me to fix it? Do you have any idea of how I can solve it? Could your code help me to do it?
You'd be very helpful, really

are you able to show those characters on the serial monitor, when put into a string? (not from twitter, but when you just do Serial.print("those special characters"); ?

You can replace those &#241 , &#191, &#161 with the actual character. I did that in another project of mine (www.jo3ri.be/arduino/projects/castduino). You can start looking for &# with Textfinder and when found replace those with along with the according number.

Something like if &# and 241 than you have ñ.

also check google on "string replace" (http://www.cplusplus.com/reference/string/string/replace/)

Nice work and thanks for sharing!

I have been playing with a similar idea for control purposes, but never actually built any of it.

A trick I find could help a lot to simplify the on-board Arduino logic would be to put a service in-between the Arduino and the Twitter API to act as a proxy and format translator.

The idea would be that you can use the right tool for the right job. Calling a REST webservice, parsing the results and doing something with the data is a piece of cake in most "internet languages", like Java, JavaScript, Ruby or PHP. With a such a proxy in place, you could re-format the response from Twitter into something very Arduino-friendly to save valuable CPU and RAM. It would also give you a separation of concerns and provide a place to add more advanced features like caching of results and adding in more sources without having to change the Arduino program.

Hosting of the translator proxy could be done on a server of yours, or on an application hosting service like the examples below.

or http://nodejitsu.com/

Anders

Nice work and thanks for sharing!

Thanks :wink:

The idea would be that you can use the right tool for the right job.

Good point, but sometimes it's just fun to have all in one solutions.

Good point, but sometimes it's just fun to have all in one solutions.

That is true and fun is one of the most important factors to consider. Why else would one have an Arduino hobby?

Why else would one have an Arduino hobby?

If you really want to know ask this in the bar sport section :wink:

hi JO3RI, many thanks for the work!

Just testing it out and it only seems to return one tweet? I am pulling tweets from https://twitter.com/BBCBreaking to return latest news items but it only returns the latest, and after that it just keeps looking but not returning tweets?

Maybe I misunderstand something, but I have tried it with other usernames and it seems the same?

Is there also a way to display my twitter feed (to display tweets from those I'm following)?

Again, thanks :slight_smile: