Home > Forum > Discussions on general problems > Activation of exit from HTTP request
- This topic has 5 replies, 2 participants and was last updated 2 years, 6 months ago da Sergio Bertana.
-
AuthorPost
-
September 13, 2021 at 12: 06 pm #61137ClaudioParticipant
I ask for assistance with a project that I would like to carry out using your PLC MPS056.
A humidity sensor connected to a portal, which, as soon as it detects that a certain threshold has been exceeded, must communicate to the PLC the activation of a relay.
How can the PLC be programmed to receive the information to activate the relay via the web interface (specifically, the PLC should receive the command to activate this relay by means of an http command sent from the PC.
September 13, 2021 at 12: 22 pm #61140Sergio BertanaAdministrator ForumIf I understand correctly, upon receiving an HTTP request you must activate a logical output.
I made you the program HTTPSetOuput, a simple example using the FB HTTPServer, a server is instantiated on port 2000. At the request of the page SetOutput.cgi, you can change it by program, output 0 is activated for 2 seconds.
Naturally you can also use parameters in GET or in POST at the page request to manage multiple commands, or define multiple pages each of which executes a specific command (Download program).
September 13, 2021 at 2: 18 pm #61141ClaudioParticipantThank you for your reply, in any case I cannot download the example (clicking on “Download program” does not start the download).
September 13, 2021 at 2: 19 pm #61144Sergio BertanaAdministrator ForumAll downloads are possible only for logged in users, by clicking on the link if you are not logged in you are redirected to the page that tells you to log in.
Isn't this the page you see?
October 1, 2021 at 9: 06 am #61361ClaudioParticipantHow can I modify the program that sent me to ensure that the output remains active even after the seconds set by the FB and is deactivated when a subsequent command is sent (the output must switch on only when the value of the variable considered is greater than a threshold value, then it must go out)?
October 1, 2021 at 9: 13 am #61379Sergio BertanaAdministrator ForumThe purpose of the programs that I publish on the forum and in the knowledge area are precisely those of arousing the curiosity and inventiveness of customers by spurring them in modifying the programs to achieve their goals.
If you look at the program WebServer, you will see that I wrote:
IF (SysStrFind(HTTPSv.pPage, ADR('SetOutput.cgi'), FIND_DEFAULT) <> eNULL) THEN SetOutput:=TRUE; CaseNr:=10; RETURN; END_IF;
now just add another program line:
IF (SysStrFind(HTTPSv.pPage, ADR('ResetOutput.cgi'), FIND_DEFAULT) <> eNULL) THEN SetOutput:=FALSE; CaseNr:=10; RETURN; END_IF;
And you will have the reset output command available. Then you will have to in the program Logic delete the timer.
We have a series of video tutorials that explain programming techniques, however remember that it is possible to buy Support to be able to contact us via Teamviewer and modify the program together.
-
AuthorPost
- You must be logged in to reply to this topic.