Go Down

Topic: Print data from temp sernsors on web page (Read 1 time) previous topic - next topic

DreamCatch

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:

Code: [Select]
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:
Code: [Select]
plen=es.ES_fill_tcp_data_p(buf,plen,PSTR(sensors.getTemperature()));

is not workinc becouse getTemperature() return float...
How to make it work?

AWOL

Code: [Select]
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
Code: [Select]
len=es.ES_fill_tcp_data(buf,plen, yourStringHere);
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

DreamCatch


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

DreamCatch

Its not working :(

Code: [Select]
  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... :|

AWOL

Quote
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?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

DreamCatch


Massimo Banzi


tolik777

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

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy