Add variable in html ESP32

For general Flowcode discussion that does not belong in the other sections.
Post Reply
MJU20
Posts: 336
http://meble-kuchenne.info.pl
Joined: Tue Dec 08, 2020 5:11 pm
Has thanked: 93 times
Been thanked: 67 times

Add variable in html ESP32

Post by MJU20 »

Fast question: how do I get a variable into a HTML file in Flowcode?

I did that ones in FC, in a wired module but can't find the file anymore.
Any directions to an example?

I want to add a temperature into a HTML-file..

Thanks.

stefan.erni
Valued Contributor
Posts: 1002
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 191 times
Been thanked: 217 times

Re: Add variable in html ESP32

Post by stefan.erni »

Hi MJU20

You can use the %1.....%10 to set in the HTML Code

Maybe this two sample help

regards

Stefan

viewtopic.php?f=9&t=739

viewtopic.php?f=4&t=761

Code: Select all

<html>
<body>
<h1>Flowcode App Developer Webserver</h1>
LED is %0
<br />
 <form action="/page2.htm">
  <input type="checkbox" id="0" name="0" value="ON" %1 >
  <label for="0"> LED Control</label><br>
  <input type="submit" value="Submit">
</form> 
</body>
</html>

MJU20
Posts: 336
Joined: Tue Dec 08, 2020 5:11 pm
Has thanked: 93 times
Been thanked: 67 times

Re: Add variable in html ESP32

Post by MJU20 »

YES!! That was what I was looking for!
Thank you stefan.erni.

Too bad I can't read the example files.
I don't have the app develop tools..

Do I need to name the variable in FC %0?

Steve-Matrix
Matrix Staff
Posts: 1471
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 204 times
Been thanked: 348 times

Re: Add variable in html ESP32

Post by Steve-Matrix »

Attached is one of those projects saved as a .fcfx file. It might not work in this form, but at least you should be able to load it and see what is happening.

The WebServer component allows you to change the values of the %1 (etc) substitution variables using the macro "SetOutValue".
Attachments
AppDev_Webserver_LED.fcfx
(16.73 KiB) Downloaded 405 times

MJU20
Posts: 336
Joined: Tue Dec 08, 2020 5:11 pm
Has thanked: 93 times
Been thanked: 67 times

Re: Add variable in html ESP32

Post by MJU20 »

Thank you Steve,

I will examine it.
The "Indicator" can be replaced by a common LED I guess.

Post Reply