[solved]Cosm feeding with Mega

Hi All,

I’m trying to use the attached sketch to feed cosm with my temp values. I’m new to Arduino programing…
So I have placed correctly the needed libraries, but it seems like cosm.h cannot be seen. when I define the include to skecth no colours modification and send error message about datastream.
Can you help me in this please? I even cannot check the schetch because of the lib…
Even don’t know wether the sketch is ok…
Many thanks!

cosm_test.txt (4.4 KB)

You have "Cosm.h" in the code - but you mention "cosm.h" in your posting...

oh sorry that was just a mistype...now I have downloaded the latest Cosm.h from github. Even it is not coloured in the code but working.
Beside this I need further help about the scetch.
It says a function-definition is not allowed here before '{' token at void loop() {

Its quite hard to see as your indentation is missing, but your { }'s are mismatched. Sort that out first!

ok,I’ll try to check that…menawhile I tried to use this code to check cosm ( code attached ) and return code is -403 on serial monitor…do you have any idea?
Anyway is there any example for using onewire multiple ds18b20 with cosm?
Thanks
update: { }'s are ok now, but I have problems with values

invalid conversion from ‘int’ to ‘byte*’

at here

int BoardTemp = (sensorValue(Board));

cosm_pelda.txt (2.39 KB)

Your code looks reasonable, it can only be a minor detail.

Here is mine http://community.cosm.com/node/1557

I thought there was something odd with the colours, but it worked.

This is the feed https://cosm.pachube.com/feeds/83153

Great to see you in here.I have found your code in cosm.That was what I want to do but with 3 or 4 pieces of ds18b20 what are not hard coded in case of change and writing to sd card.
With a mega its quite hard I realised that I have to wire out the pins of I2C because of wiznet card...ok but first...tried your code and -403 message too ( almost the same, but addressed twice the same DS18B20)

Return code is still -403 .... Does anybody have any idea?

I had a nightmare with 403. I don't think the 403 signal has anything to do with your code, and it has everything to do with managing your cosm console. I believe the 403 confirms your interent connection procedure is kosher so, If your code puts the right information on your screen, or w.h.y., leave it all alone for the moment and address the cosm problem. I had to walk away and start over again, but I imagine there is usually a simpler solution.

My gear uses two thermometers at the moment but, once you get it right with one, it will do fifty. The code I published was for Uno. I have a Mega 2560 but I have not gotten that far with it just yet, but the relevant section should be fine on a Mega. I'm not sure what you are saying about the pins or the problem, if any, with the Wiznet card but you surely can't be short of pins, and I don't think that is where your real problem lies anyway..

I think I will start the create a new sketch as a starting point of this:

maybe it will work...

vespapierre:
I think I will start the create a new sketch as a starting point of this:

Good luck. I went through a painful progress of LAN, WAN, and internet feed back, but I think you have got all that sorted. I don't think your sketch is the problem but, if the new one works, I guess I stand corrected! If it doesn't, I don't. In cosm's API docs, the HTTP status code says "403 Forbidden: Cosm understands your request, but refuses to fulfill it." Clearly, you have succeeded in contacting cosm, it's just that it is telling you to piss off, it doesn't want to know you. Once I sorted the console out, my sketch immediately worked, without my having to do anything extra on it.

What do you mean on " sorted the console out" ? :relaxed:
I tried to open new topic on cosm's community ..but still no answer...I guess I have to find the problem by myself...I will try different sketches...

You will see the whole sorry mess on the cosm forum, a couple of weeks or so ago. I still don't fully understand what happened, although I guess it was self-inflicted. Essentially, the API key was not linked to the feed I wanted to use but it was to the feed I didn't want. This was all pretty clear when I looked at the console but I had no idea of how to fix it, so I started all over again.

Log in to cosm and check the console, not the feed.

So now it is working!!! The most important thing is to use these libraries:

cosm:
https://github.com/cosm/cosm-arduino/zipball/master

httpclient:
https://github.com/amcewen/HttpClient/zipball/master

it was hard to find...