I'm having trouble sending twitter updates from a PIC ENC28J60 based ethernet shield. Has anyone ever had any luck with this?
I've followed a few examples and come up with a rough sketch to send a tweet to twitter. I seem to be stuck around the "waiting for ACK reply" part. I'm able to get past this stage of the program when I try to connect to a local PC on my network, which leads me to think that I'm having trouble getting out through my router onto the internet. Does anyone know if I need to handle routing myself?
I have the same ethernet shield, I've not tried your example but have had a play with the examples and also used it as the basis for a NTP clock based on the software from Tuxgraphics.org.
One thing to note with this ethernet shield is that the software provided wont directly connect to the internet. From looking at your code, you are trying to connect to 128.121.146.228 (twitter.com) from 192.168.2.91 (your arduino), however, what you havn't specified is how the packets get from the 192.168 network to the twitter address. You need to go via the gateway or router that you connect to the internet with.
I coded this up in my NTP application. I had the address 10.0.0.15 on the arduino then a gateway address of 10.0.0.1, which the ARP then requested the mac address of in order to direct the outbound packet to the destination on the internet.
The code is currently a bit messy as I hacked a lot of the NTP code into the etherShield library for speed of development, but this increased its size if the NTP code isnt used, so not really useful for other applications. I'm in the process of re-writing it keep the original library but provide additional wrappers for the NTP code and HTTP GET and POST actions.
I'm also looking to do a twitter client, but based on the additional http code I'm writing.
Just after posting the last message I had a look at the tuxgraphics.org site again and found they had recently updated their ENC28J60 TCP/IP stack, so promptly abandoned my half hearted efforts and decided to port theirs.
I have now added this into the original EtherShield library from nuelectronics and have a working library that can be used as a direct replacement it. The code is much simpler to work with which makes for shorter programs. The code is also network aware, so after specifying your local router address, it can connect to internet sites.
I've currently got the basic webserver demo and a simple twitter client working with it. I need to do another demo then I'll get this packaged up and made available over the weekend for others to try.
Great! You're doing us ENC owners a tremendous service :).
I haven't had much time to play with it this past week since I've been out of town. I'd hoped to be making some ridiculous tweeting machines by this time, something like the twittering cat flap or twittering flowerpots
Finally got this running with a couple of demos. It took a bit longer than expected as there are always so many other things to do!
Anyway, I've an updated ENC28J60 ethershield library that works with the nuelectronics.com ethernet shield. The TCP/IP stack is basically a port of the code from tuxgraphics.org to Arduino library and includes web client and server code along with ntp and wol (not tried or tested this part yet).
Fantastic! Your method seems a lot simpler than using the HTTP post method too. There's going to be a lot of random devices tweeting this weekend :). Follow @paddyplugged in if your interested.
Digging this up from the dead in the hopes that AndyL sees it. I'm planning on using an ENC28J60-based Ethernet interface to post messages to twitter. I downloaded the zip file in the blog post you linked, loaded it in arduino-018, and tried to compile the twitter example. I get this:
In function 'int8_t analyse_get_url(char*)':
error: 'class EtherShield' has no member named 'ES_find_key_val' In function 'void loop()':
I saw that a user on your blog had the same issue but didn't see that there was any resolution. Wondering where to start troubleshooting?
I think I've gotten around the issue, but I don't understand the details.
The code in the pde was calling some functions that, in the library files, were surrounded by if statements. I commented those statements out (in enc28j60.h, enc20j60.h, websrv_help_functions.h, websrv_help_functions.c). The example sketch now compiles. I don't have the hardware soldered up yet so I can't see if it actually works, but at least it compiles.
I'm a neophyte when it comes to library development, so I'm not sure what those if statements were there for. It looked like they were intended to only include certain blocks of code if certain functionality was desired, or something along those lines.
Once I get the hardware finished I'll report back if it works or not.