Page 1 of 1

Showing variables in webserver

Posted: Tue Jul 26, 2022 8:03 am
by RGV250
Hi,
I am trying to find out about variables in a webserver, this does not seem to be that well documented. I found a post on the old forum from around 2004. I found 2 on this forum but both require App developer so I cannot open them as I do not have it.
I looked on the WiKi but drew a blank. Also there appears to be quite a limitation with 4 variables per page?
Could someone point me to a good example and to where the information is with all the limitations and if there are ways around this or has it improved with the newer versions of FC.
I plan to use either ESP32 or possibly Raspberry Pi but that would require a licence so not good for a demo.

Regards,
Bob

Re: Showing variables in webserver

Posted: Tue Jul 26, 2022 10:48 am
by BenR
Hello Bob,

The webserver Generic component allows for up to 30 individual outgoing substitutions to be made to show things like variables.

Simply set how many substitutions you would like and their length via the component properties.

To reference the substitution on your html page simply use %0 to %29 to reference the substitution. If you need to display a % character then use %% in your HTML code.

Set the value of the substituion using the SetOutValue macro. For numeric values you can convert them to string by using the ToString$() or FloatToString$() functions.

This video shows the basics of creating a ESP32 based webserver.
https://www.youtube.com/watch?v=DaViZAhSxuQ