Hi Everyone,
Is there a basic example of an webserver running in App developer. This web page with buttons and LEDs and how to pass the button press and control on LEDs.
Thanks,
Wayne Millard
App Developer Webserver
-
- Posts: 94
- http://meble-kuchenne.info.pl
- Joined: Fri Dec 04, 2020 6:12 pm
- Has thanked: 1 time
- Been thanked: 9 times
-
- Matrix Staff
- Posts: 1746
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 444 times
- Been thanked: 604 times
Re: App Developer Webserver
Hi Wayne,
This works pretty well, it sends the form data to page 2 which collects and parses the input before redirecting back to the index control page.
The reason for the second page is that we can process the input and assign the output and this way the status text for the LED is correct and not a refresh behind as it would be with a single page.
Input 0 controls the LED state and is either "" for off or "ON" for on.
Output 0 controls the LED state text reported on the index page and is "OFF" for off and "ON" for on.
Output 1 controls the checkbox state to ensure the user's last input is remembered. It has the values "" for off and "checked " for on.
index.htm HTML
page2.htm HTML
If you wanted you could get rid of the submit button and add some javascript to auto submit the form on change.
This works pretty well, it sends the form data to page 2 which collects and parses the input before redirecting back to the index control page.
The reason for the second page is that we can process the input and assign the output and this way the status text for the LED is correct and not a refresh behind as it would be with a single page.
Input 0 controls the LED state and is either "" for off or "ON" for on.
Output 0 controls the LED state text reported on the index page and is "OFF" for off and "ON" for on.
Output 1 controls the checkbox state to ensure the user's last input is remembered. It has the values "" for off and "checked " for on.
index.htm HTML
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>
Code: Select all
<meta http-equiv="refresh" content="1; URL=/index.htm" />
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Posts: 94
- Joined: Fri Dec 04, 2020 6:12 pm
- Has thanked: 1 time
- Been thanked: 9 times
Re: App Developer Webserver
Hi Ben,
I have tried you example and thanks for that i have a problem that when i press the submit button it takes me to page2 and does not take me back to index page.
Thanks,
Wayne Millard
I have tried you example and thanks for that i have a problem that when i press the submit button it takes me to page2 and does not take me back to index page.
Thanks,
Wayne Millard
-
- Matrix Staff
- Posts: 1746
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 444 times
- Been thanked: 604 times
Re: App Developer Webserver
Hi Wayne,
Hmm that's interesting what browser are you using, I was using Firefox and it was working 100% of the time.
Maybe try increasing the refresh time to 2 or 3 seconds and see if that helps?
Hmm that's interesting what browser are you using, I was using Firefox and it was working 100% of the time.
Maybe try increasing the refresh time to 2 or 3 seconds and see if that helps?
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel