Go Down

Topic: Cosm sketch for official ethernet shield (Read 847 times) previous topic - next topic


Dear all,

I have an Arduino Mega 2560 and the Official R3 Ethernet Shield. I could not find a sketch that works until i stumbled upon the following thread (http://arduino.cc/forum/index.php/topic,137556.0.html), where this sketch (http://playground.arduino.cc/Code/WebClient) was recommended.

However, I cannot get it to work with Cosm. Has anyone made any progress on that? Any other code I found just does not work.

Thanks in advance for any help!


Any other code I found just does not work.

What code? What "doesn't work"? You know that "doesn't work" is pretty lame, right? There is absolutely nothing to go on. The only thing we know is that, by your definition of work, whatever that is, the code failed to live up to your expectations, whatever they were.
The art of getting good answers lies in asking good questions.


Dec 19, 2012, 12:39 am Last Edit: Dec 19, 2012, 12:41 pm by NickPyner Reason: 1

However, I cannot get it to work with Cosm. Has anyone made any progress on that? Any other code I found just does not work.

The reason why the sketch won't work with cosm is that it was never intended to work with cosm.  There is plenty of code around that does work. The most likely place to find it is in the "It Works!" section of the cosm forum. You will even find one of mine you can use or adapt.

I suspect you don't know what cosm is about. It is an internet data service that you feed to, but that data can be made available to the public. The vital thing is that it uses two keys - a feed id that the public can use, and yourself, and an API key that is exclusive to you, covers all your feeds, and is used for maintenance etc. Any cosm sketch will contain both these keys.

The first thing you need to do is register with cosm  and thereby obtain the keys.

Note that a "feed" may include several sensors. It is not necessary to include date and time in a feed.

Note also that there a couple of new libraries, cosm and httpClient, that make life a lot easier.



Dec 20, 2012, 09:45 am Last Edit: Dec 20, 2012, 09:55 am by Filippos Reason: 1
Thanks for your replies. Let me be more specific in this post, I only meant to give a general idea of the issue in order to see of I was overlooking something apparent to more experienced users. I am just starting to work with the Arduino and my errors could be elementary... :(

  • I can use the arduino as a server and i.e. set up a webpage that refreshes and contains the temperature I read from a sensor

  • I tried several sketches, like the ones for twitter, cosm, Thingspeak, but I could not get it to upload data. Even the simple http example from arduino didn't work. I could ping to the IP address, and I got messages with codes that I could not find what they meant (i.e. cosmclient.get returned -3). I tried the wiki on http error codes but there were no such numbers.

  • My connection is with static IP, so I give all the relevant info for the Ethernet. The fact that I can ping to it and it replies, means that this part has been properly set up right?

  • About cosm, I have set up a new account and feed, and have always included the keys in it.

  • The sketch in http://arduino.cc/forum/index.php/topic,137556.0.html is the only one that allowed me to use the arduino with the GET command


OK. Now assuming you have some code for using cosm, and assuming a clear understanding that there is no connection between the code you posted and that required for cosm, try uploading the cosm code. Use the # button and paste it between them. Truncate the API key.


Some reading material.

Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

Go Up