Hi,
I was reading the following blog as I have very little knowledge of web servers etc:
https://www.matrixtsl.com/blog/internet ... led-relay/
and decided to have a go at it. I seem to be quite close, but the web page isn't quite behaving as expected. I have included a screenshot of the web page as well a copy of the FC8 file. The web page is also not responsive, and seems to behaving more like a data entry field rather than a "button". Any suggestions? I tried using Google Chrome on my PC and Safari on my iPhone. Both gave the same results.
Switching an output with ESP8266
Moderator: Benj
Switching an output with ESP8266
- Attachments
-
- Screenshot (2).png
- (88.56 KiB) Downloaded 1400 times
-
- FlowCodeV8_NewPCB_Test.fcfx
- (26.32 KiB) Downloaded 228 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Switching an output with ESP8266
Hello,
Did you write the HTML code in Word by any chance?
I'm seeing this.
They should instead look like this '%2' which for me is pressing the @ key without pressing shift (UK keyboard). Either directly into Flowcode or into a text editor (not Word).
Mentally shakes fist angrily at Word
Hopefully this is the root cause of the problems you're having.
Edit: I see the code is from our Wordpress blog, so it looks like this does the same Unicode conversion that Word does.
Mentally shakes fist angrily at Wordpress
Did you write the HTML code in Word by any chance?
I'm seeing this.
And not sure if you can tell but the quotes for example ’%2′ seem to be unicode quotes and so won't work as expected.<body class=’%2′>Output is %2<p><form action=’process.htm’
They should instead look like this '%2' which for me is pressing the @ key without pressing shift (UK keyboard). Either directly into Flowcode or into a text editor (not Word).
Mentally shakes fist angrily at Word

Hopefully this is the root cause of the problems you're having.
Edit: I see the code is from our Wordpress blog, so it looks like this does the same Unicode conversion that Word does.
Mentally shakes fist angrily at Wordpress

Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: Switching an output with ESP8266
Hi Benj,
Thanks for the reply. I've made the changes that you suggested, but the output is still the same. I've attached the FC8 file. Any more suggestions?
Thanks
Thanks for the reply. I've made the changes that you suggested, but the output is still the same. I've attached the FC8 file. Any more suggestions?
Thanks
- Attachments
-
- FlowCodeV8_NewPCB_Test.fcfx
- (26.39 KiB) Downloaded 237 times
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
Re: Switching an output with ESP8266
Hi,
Looks OK apart from the extra characters before process.htm
Looks OK apart from the extra characters before process.htm
Code: Select all
action='process.htm'
Re: Switching an output with ESP8266
Hi,
The issue seems to be that the %1, %2, %3 variables (index.html) are not functioning. For example, when I click on the "submit", the "get" request is generated, but without the value for 's'...
192.168.4.1/process.html?s=
is being sent, so the '0' or the '1' is not being attached to the URL. If I manually force s="1", then it works.
i.e. <input type="hidden" name="s" value="1"> ....this works
Any ideas?
I've attached the slightly modified FC file as well as the index.html here for easy reading....
<!DOCTYPE html>
<html><head><title>IoT Remote Control</title>
<style>
.On {
font-family: Arial;
font-size: 72px;
font-weight: bold;
background-color: lightgreen;
text-align:center;
}
.Off {
font-family: Arial;
font-size: 72px;
font-weight: bold;
background-color: red;
text-align:center;
}
</style>
</head>
<body class=%2>Output is %2
<p>
<form action="process.html"
method="get">
<input type="submit" value="Switch %3">
<input type="hidden" name="s" value=%1>
</form>
</p>
</body>
</html>
The issue seems to be that the %1, %2, %3 variables (index.html) are not functioning. For example, when I click on the "submit", the "get" request is generated, but without the value for 's'...
192.168.4.1/process.html?s=
is being sent, so the '0' or the '1' is not being attached to the URL. If I manually force s="1", then it works.
i.e. <input type="hidden" name="s" value="1"> ....this works
Any ideas?
I've attached the slightly modified FC file as well as the index.html here for easy reading....
<!DOCTYPE html>
<html><head><title>IoT Remote Control</title>
<style>
.On {
font-family: Arial;
font-size: 72px;
font-weight: bold;
background-color: lightgreen;
text-align:center;
}
.Off {
font-family: Arial;
font-size: 72px;
font-weight: bold;
background-color: red;
text-align:center;
}
</style>
</head>
<body class=%2>Output is %2
<p>
<form action="process.html"
method="get">
<input type="submit" value="Switch %3">
<input type="hidden" name="s" value=%1>
</form>
</p>
</body>
</html>
- Attachments
-
- FlowCodeV8_NewPCB_Test.fcfx
- (27.12 KiB) Downloaded 293 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Switching an output with ESP8266
Hello,
Looking at your program and the ESP8266 properties don't look quite right.
The incoming and outgoing substitution counts are both set to 1, yet your html code references at least 4 outgoing values (0-3). This is likely the cause of the problem.
Looking at your program and the ESP8266 properties don't look quite right.
The incoming and outgoing substitution counts are both set to 1, yet your html code references at least 4 outgoing values (0-3). This is likely the cause of the problem.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: Switching an output with ESP8266
Thanks Benj,
I've made some progress. It seems like it is looking for an initial state for %1, %2, %3, so if I manually type the following into the address bar (which clicking on the submit button should do):
192.168.4.1/process.html?s=1
then it responds correctly and thereafter everything works 100%.
I've made some progress. It seems like it is looking for an initial state for %1, %2, %3, so if I manually type the following into the address bar (which clicking on the submit button should do):
192.168.4.1/process.html?s=1
then it responds correctly and thereafter everything works 100%.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Switching an output with ESP8266
Hello,
Glad it's working well for you now.
You can set the initial state of the substitution by calling the SetOutValue component macro after the ESP initialise macro but before the while 1 loop.
Glad it's working well for you now.
You can set the initial state of the substitution by calling the SetOutValue component macro after the ESP initialise macro but before the while 1 loop.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel