Add variable in html ESP32

For general Flowcode discussion that does not belong in the other sections.
Post Reply
MJU20
Posts: 353
http://meble-kuchenne.info.pl
Joined: Tue Dec 08, 2020 5:11 pm
Has thanked: 101 times
Been thanked: 70 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: 1066
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 201 times
Been thanked: 225 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: 353
Joined: Tue Dec 08, 2020 5:11 pm
Has thanked: 101 times
Been thanked: 70 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: 1560
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 214 times
Been thanked: 362 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 424 times

MJU20
Posts: 353
Joined: Tue Dec 08, 2020 5:11 pm
Has thanked: 101 times
Been thanked: 70 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