Would anybody on here be able to point me in the right direction
My goal is to be able to increment a defined counter (Internal Tag) from a range of 0 - 100 when a tag (Boolean) within the ewon is triggered from "0" to "1"
This would allow me to display certain animations such as "Cogs" or moving objects on my pages rotation based on a boolean value.
My ewon tag is "DO_Transfer_Conveyor_Strt_Req" so therfore when this tag is equal to "1" I would like for an internal tag to increment up (Being clamped within a working range of 0-100)
Once the tag "DO_Transfer_Conveyor_Strt_Req" returns back to "0" then the internal tag can return back to 0.
21-09-2021, 08:40 AM (This post was last modified: 21-09-2021, 08:42 AM by alma.)
Hi Dan.
To do this I recommend you to use javascript.
The viewOn view is just an SVG object in an shtm file that you can retrieve from your Ewon by FTP (in usr>viewOn)
In this file, you can add javacript and give an Id to your SVG object in order to modify it.
As for the JavaScript were does this content get entered. You will have to forgive me as I'm new to java scripting
The example below does seem like something i could use ,however would this just rotate "My" object once by 45 degrees?
Sorry but I need to be sure of something. Is your question only about changing the value of your tag when your boolean changes ? Or do you also need explanations on how to make your image rotate ?
My goal is to have an object rotating when a tag of mine becomes true.
This tag would be a Boolean type.
e.g when "Output_1" is true, then is it possible to have a local Ewon tag defined that would increment up from 0 - 10.
This tag could then be used to rotate my objects.
So far I have managed to get objects to rotate in a circular motion based upon an integer tag being used from the PLC.
Then you can add this BASIC script in your Ewon to modify your rotation when your boolean changes :
Code:
ONCHANGE "YourBool" ,'@rotate' //Call rotate function when boolean is changed
FUNCTION rotate
Bool = GETIO "YourBool" //Your boolean tag
Rotate% = GETIO "YourRotation" //Tag which rotation is based on
Inc% = 1 //Step you want to add to your rotation value when boolean changes
NewValue% = Rotate% + Inc%
IF(Bool=1) THEN SETIO "YourRotation",NewValue% //Modify rotation only when bool passes from 0 to 1
ENDIF
ENDFN
(21-09-2021, 03:42 PM)Dan.Redding Wrote: When my PLC tag is true would the rotation value continue to count up from 0 - 10 then repeat if the tag was to remain on?
or is this script incrementing by a "%" that i give when this tag value changes from 0 - 1 or 1 - 0?
No because your rotation value is only updated when your bool is changed from 0 to 1.
Could the "Rotation" tag be defined in the ewon and therefore e configured to increment from 0 - 10 lets say. (Rolling timer in the background)
Then this would allow for my animation to rotate when my tag becomes true.
(21-09-2021, 04:05 PM)Dan.Redding Wrote: Could the "Rotation" tag be defined in the ewon and therefore e configured to increment from 0 - 10 lets say. (Rolling timer in the background)
Then this would allow for my animation to rotate when my tag becomes true.
Of course. And once defined you can modify it in your script as you want.