Hello,
Im using ethernet shield with ENC28J60. Im trying to print data from temp sensor to web page.
To print data to web in example:
uint16_t print_webpage(uint8_t *buf)
{
plen=es.ES_fill_tcp_data_p(buf,plen,PSTR("HTML HERE"));
}
Now i want to print there sensors.getTemperature() from OneWire Dallas library.
this:
plen=es.ES_fill_tcp_data_p(buf,plen,PSTR(sensors.getTemperature()));
is not workinc becouse getTemperature() return float...
How to make it work?
len=es.ES_fill_tcp_data_p(buf,plen,PSTR(sensors.getTemperature()));
That doesn't make any kind of sense - "getTemperature" presumably is a function returning a value, so it's result cannot be found in PROGMEM.
You could use sprintf to make an ASCII string out of the float, then
len=es.ES_fill_tcp_data(buf,plen, yourStringHere);
system
May 17, 2011, 11:32am
3
Thank You! i just read about PROGMEM and PSTR. Now i know why it's not working
Its not working
dtostrf(tempSensor.getTemperature(),3,2,vstr);
Serial.println(vstr);
plen=es.ES_fill_tcp_data_p(buf,plen,vstr);
On serial i can see '16.87', but last line hang up board... when i remove it, its working ok...
plen=es.ES_fill_tcp_data_p(buf,plen,vstr);
The _p at the end of the name of that method suggests to me it expects a PROGMEM parameter for vstr
Is there a "ES_fill_tcp_data" method?
Yes! And its working now
Thank You!
thanks AWOL, he's now banned
system
June 11, 2011, 2:26pm
8
DreamCatch , what solution for your problem?
A have a similar problem (show temperature from ds18b20 on webserver via ethernet shield)