...
b) Double-click the second-hand object to bring up the [Object Configuration] window. Select the [Rotate] feature and configure the object as shown below.
...
c) In the [Rotate] tab, you must assign the ‘Center Point’. To find the coordinate, place the mouse cursor on the center point. You will find the coordinate at the right-bottom of the Xpanel DesignerXpanelDesigner.
...
(2) Script
a) Select [Tools] – [Script] – [New Script] to bring up the [Add Script] window. Set the running type as ‘Period’ then set the period as 1 sec.
...
b) Write the script as shown below. When the value of the “ROTATE_SEC” reaches or exceeds 360, the script will store 6 to the tag to continue the rotation. The object will rotate 6° per second.
...
VAR A; //Declare variable A A=ROTATE_SEC; //Save ROTATE_SEC value to A
IF(A>=360) { ROTATE_SEC=6; //ROTATE_SEC becomes 6 when it reaches 360 } ELSE { ROTATE_SEC=A+6; //Object rotates 6 degrees per sec } |
...
a) Write the project to Xpanel or execute the project with the simulator. You will find that the second-hand object rotates each second.
...