Page 1 of 1

App Developer Webserver

Posted: Fri Oct 29, 2021 6:57 pm
by wayne_millard
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 :D

Re: App Developer Webserver

Posted: Mon Nov 01, 2021 1:13 pm
by BenR
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.
AppDev_Webserver_LED.fcsx
(16.96 KiB) Downloaded 176 times
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>
page2.htm HTML

Code: Select all

<meta http-equiv="refresh" content="1; URL=/index.htm" />
If you wanted you could get rid of the submit button and add some javascript to auto submit the form on change.

Re: App Developer Webserver

Posted: Tue Nov 02, 2021 4:10 pm
by wayne_millard
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 :)

Re: App Developer Webserver

Posted: Fri Nov 05, 2021 9:57 am
by BenR
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?