Pages: [1]   Go Down
Author Topic: Cosm sketch for official ethernet shield  (Read 548 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
P.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

Temple, Texas
Offline Offline
Sr. Member
****
Karma: 14
Posts: 360
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Works great for me.

John
Logged

Dee Why NSW
Offline Offline
Full Member
***
Karma: 5
Posts: 206
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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.

https://cosm.com/feeds/83153

« Last Edit: December 19, 2012, 06:41:30 am by NickPyner » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,
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... smiley-sad
  • 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
« Last Edit: December 20, 2012, 03:55:59 am by Filippos » Logged

Dee Why NSW
Offline Offline
Full Member
***
Karma: 5
Posts: 206
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Some reading material.

https://www.google.com/search?num=100&hl=en&tbo=d&site=&source=hp&q=cosm+site%3Ahttp%3A%2F%2Farduino.cc%2Fforum%2F&oq=cosm+site%3Ahttp%3A%2F%2Farduino.cc%2Fforum%2F&gs_l=hp.12...3302.9885.0.13018.3.3.0.0.0.0.49.143.3.3.0.les%3B..0.0...1c.1.vhd7bEUlpKE
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Pages: [1]   Go Up
Jump to: