Hi again,
i finally got my sketche working with the enc28j60. Now i'm able to send to my domotic box the temperature of a one-wire sensor. The only problem that i have is it dont take in concideration the . and the to number next to it so if temperature is 21.56 only 21 will be sent.
Here the code:
void loop () {
ether.packetLoop(ether.packetReceive());
if (millis() > timer) {
timer = millis() + 10000;
sensors.requestTemperatures();
Serial.println(sensors.getTempCByIndex(0));
Serial.println();
Serial.println("<<< REQ ");
char myIntAsString[24]; // 7 bytes is enough to contain any int, including minus sign and terminating zero
itoa((sensors.getTempCByIndex(0)), myIntAsString, 10);
Serial.print(myIntAsString);
ether.browseUrl(PSTR("/data_request?id=variableset&DeviceNum=38&serviceId=urn:upnp-org:serviceId:TemperatureSensor1&Variable=CurrentTemperature&Value="), myIntAsString, website, my_callback);
}
}
Here the result in the serial print:
P: 192.168.2.124
GW: 192.168.2.1
DNS: 192.168.2.1
SRV: 192.168.2.19
19.25
<<< REQ
19>>>
HTTP/1.1 200 OK
content-Type: text
...
So before convert it to a compatible const char*, sensor read 19.25, but it send 19.
Any idea
Thanks