Javascript
-
@jaroslav_sobota said in Javascript:
Example 0301-20
Example 0301-20 is a good example, but with what piece of script I can switch a lamp on and off with a button
-
Hi Martijn,
there is no code to switch a lamp on or off directly from HMI. In REXYGEN HMI, you always control parameters of the function blocks in your running algorithm. These may result in switching the lamp on or off, depending on how your blocks are connected.This basic principle is the same regardless of what HMI you build. Even if you build your very own HMI page, you'll use functions to write parameter values to function blocks. And possibly also to read their inputs and outputs.
Hope this helps, let me know.
Jaroslav
-
@jaroslav_sobota
can you also show me the javascript code you used for that button and Spider? -
I want to make it like this (see link) and then in every red box you can turn on and dim another light
-
@martijnperdaan
Hi Martijn,
the switch and slider are standard components of REXYGEN HMI Designer - there is no need for any additional custom javascript.Please, go through Chapter 3 of REXYGEN HMI documentation. Once you run into any troubles let me know and I will try to guide you.
Regards, Tomas
-
@martijnperdaan
Hi Martijn,
if you insist on building your very own HMI page, have a look at the example 0301-20 as I mentioned earlier. It contains also the Javascript code to read and write data from/to your running algorithm via REXYGEN REST API.Best regards
Jaroslav -
yes i have seen that and that is a nice example only can you help me a bit on how to use a slider and 3 switches and how the javascript code should look like from a REXYGEN REST API.
-
@martijnperdaan
Hi Martijn,if you send us all your project files (zipped project folder) and list of parameters controlled by slider/switch I will prepare the HMI svg sample file for you.
You can upload the project directly here to the forum or send via e-mail to support@rexygen.com
Regards, Tomas
-
ok but i don't need hmi svg sample just the javascript code to work the multiple sliders and switch with a REXYGEN REST API.
i want to do it through my own php page
-
Hello Martijn,
here is an example with one CNR and 2 CNB constants which are controlled from web HMI via REST API: 0301-21_REST_API_Webpage_Javascript.zipI believe that's all you need. Now it's on you to build upon this concept.
Btw, what is your motivation for building your very own HMI? From your questions I guess that using the HMI Designer and building the HMI without any hand coding would be much easier and more straightforward for you.
Let me know.
Jaroslav