You have defined your temprature variable as a char, this is use for single ASCII symbols so it is the wrong thing to use. It needs to be an int or a float.
Try with int and float, same problem, ethercard seems to need a const char* in the formule: ether.browseUrl(PSTR.....
How could i declare a const char* that could be variable.
(1) @PaulS and @Grumpy_Mike... why not declare temperature as a char? Last time I checked, the temperature around here is unlikely to get above 127 degrees C or less than -128 degrees C. What on earth is the point in using an int when you don't need two bytes to store the value, you are just wasting a byte of precious RAM. Remeber folks, just because a char is called a char doesn't mean it has to be used to store a character! (Oh, and the temperature could be 'H', that would be room temperature if it were in fahrenheit: 72 degrees F is approx. 22 degrees C)
(2) The issue lies in this line:
ether.browseUrl(PSTR("/data_request?id=variableset&DeviceNum=49&serviceId=urn:upnp-org:serviceId:TemperatureSensor1&Variable=CurrentTemperature&Value="), temperature, website, my_callback);
You first need to convert the temperature to a string of characters before passing it to that function. For example:
Thanks,
i try what you say and now i'm able to compile it without error.
The problem now is that it give me a bad request. If i print the temp, it give me the temperature. If i replace the temp with "88", no error occur and value 88 is updated. I'm lost
smallpoul:
Thanks,
i try what you say and now i'm able to compile it without error.
The problem now is that it give me a bad request. If i print the temp, it give me the temperature. If i replace the temp with "88", no error occur and value 88 is updated. I'm lost
This is a test for a missing control in your receiving, server-side code. 88 is an unusual, but valid value. In normal conditions the sensor would not return such a value, but if you "force" it into the query request there's nothing the Arduino can do; you need to provide a value-checking routine in your server code.