Twittering using ethernet shield (Basics)

Yes I did read that.
The problem I am having is loading the code.
I am new to Arduino coding, but what does restarting the Arduino have anything to do with problems loading the code?

Thanks,

Alan

Did you put the "unzipped" twitter directory in arduino/hardware/libraries/ directory?
If so, you should be able to load SimplePost sketch by selecting File>Examples>Twitter>SimplePost.

Ahhh OK...
I got what you are getting at.
I am using a mac for the programming so I might have messed up the file location.
I followed this thread.
I really should try and find a PC and try it again.

Thanks,

Alan

OK I found a PC and the code loads fine.
After setting it all up and running the Arduino I get a "failed : code 401"
Does anyone know what that is?
I removed the ethernet cable and I get "connection failed" so I know that it recognizes the cable.

Thanks,

Alan

The HTTP error code 401 you got means "Authorization Required / Unauthorized".
Did you change the following line
Twitter twitter("YourID:Password"); as to your real twitter account?

I think I have the right user ID and password.
I used base 64 for it.
I'll try and recheck the encoding though.
Thanks for the error code.
By the way, are the error codes posted somewhere?

Thanks again,

Alan

I used base 64 for it.

The cleaver clever library automatically encodes the characters, so you don't have to encode by yourself.
Please try to put your ID and Password directly.

Got it, I'll try that first...

Thanks,

Alan

OK, I changed the USER ID & Password to my user name & pass and it works.

I am working on the button side of the code.

After that I just need to compile them together.

Wait I didn't even say what my project is....

If you are curious see this posting...

Thanks for the help,

Alan

I have been trying for days to get my Ethernet shield to connect to the internet. I was successful once in trying to ping Google, but have not been able to repeat.

I am using the twitter library and sample code, added my "token" and get a Failed Code: 403 when the sketch is run. I had to include a 40 second delay in the sketch to give the shield time to initialize (shield will blink FULLD, LINK, 100M in unison for several seconds before settling in on a steady LINK and FULLD, sometimes 100M). (<---not sure if thats normal)

I have the shield hooked directly to my D-Link DIR-825 router. All other devices connected to that router have a valid connection.

I have a feeling that it has something to do with my login (yes I am logged out of Twitter when trying to connect w/ the Arduino)

Interestingly enough the shield has started working... randomly. The tweets go through and are displayed on twitter but I am still getting a "failed : code 403" on the Serial Monitor

holy christmas cookies..... its not working again... i changed NOTHING!!!! Now getting a code 500 error

help?

How to get the number of unread tweets? I want to make a notifier for new messages to Twitter only through Arduino without using PC.

FYI - if you are not crazy about entering your twitter credentials into an unknown website to get it base64 encoded (I mean, who knows who does what with the fields entered?) you can do it yourself pretty easily with python:
On a PC you can get python installed and initiate it too - google your way

On Mac: Open terminal, type "python" to get a >>> python prompt
Let's say you want to b64 encode "bob:pword" Simply do this:

import base64
base64.b64encode("bob:pword")

you'll get back:
'Ym9iOnB3b3Jk'

And that's it! All securely on your own box. (Type quit() to get out of python)

Actually, you never enter your login details on anything other than twitter.com's own pages, and the token you get isn't an encoded username:password string.

Twitter has changed their authentication methods to a rather complex system of tokens and encryption, which is pretty much beyond the Arduino's capabilities. Instead, the current library connects to a webapp on the author's website which posts to Twitter on your behalf. It never knows your login details, it just asks Twitter.com to authenticate you and gets a special token from them that lets it post to your account, but not log in or change any settings. I expect the webapp doesn't save any of those tokens, but uses the one you pass in directly. Any other webapp would have to get their own individually authenticated tokens, as tokens are specific to each registered webapp.

Changing your password invalidates all such tokens, so you would have to get new ones after doing so.

(I have to wonder whether the webapp is able to handle the load of all the arduino's tweeting to it; I'm only getting very sporadic success with it right now.)

I'm having the same sort of intermittent troubles that others have described. In one case it was due to a fail whale situation, but in general, Twitter seems to be working fine but I generally get 403 errors, along with a few 500s. Sometimes I get these errors and the tweets go through just fine. Until today, I almost never got those errors and the post almost always went through. I have no idea why this would be happening, because this was working fine when I started with the code a month ago. I got the tokens for OAuth working and I was able to send tweets very reliably. Then I set this project aside to do some other stuff and now that I've finally gotten back to the project, everything has gone pear-shaped. Anyone know if this is a problem with the web server app or is there some other problem? Has anyone come up with solutions to this? I really like this code and it would be nice to be able to use it, but if it's not going to provide at least a semi-reliable connection, I think I'm outta luck... :frowning:

Perhaps a way around this would be to register our own application on Twitter. I suppose that would mean we would all need our own webservers to handle the arduinos posts though. Oh, Twitter, why so difficult!?!

I'm trying to get my washing machine to send out a notification when its done. I thought Twitter would be the best medium. I guess not. What do I use now? ahh!

Oh, Twitter, why so difficult!?!

Never seen the twitter stuff, but it is probably advertising funded. Twitter bots can't read ads or buy stuff, so I would think twitter would do what ever it could to limit access to only potential customers and not bots.

Ahh, good point. Wait... Twitter has a business model? ::slight_smile: