Print data from temp sernsors on web page

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);

Thank You! i just read about PROGMEM and PSTR. Now i know why it's not working :slight_smile:

Its not working :frowning:

  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... :expressionless:

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 :slight_smile:
Thank You!

thanks AWOL, he's now banned :slight_smile:

DreamCatch, what solution for your problem?
A have a similar problem (show temperature from ds18b20 on webserver via ethernet shield)