Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 6 Next »

Creating an Analog Clock

  1. Create 4 analog tags with “INT16” for Type and “Virtual” for I/O Device.

  2. Create a clock interface manually or search “3D Silver Clock” in the Image Library, then drag and drop the image to the page.

  3. Create an hour hand and a minute hand for the clock using the Line tool, or search “Arrows” in the Image Library, then drag and drop the image to the page.


  4. Create three scripts. One script establishes a real-time clock and writes the current hour and minute into their own tags, and the other two are used to control the rotation of the hands of the clock.

  5. On the Edit Script Properties window, configure the “RTC” script Running Type to Startup. As for the “MinuteHandIncrement” and “HourHandIncrement” scripts, set the Running Type to Manual.

  6. Edit “CurrentMin” tag to have the script “MinuteHandIncrement” execute when the value changes.

  7. Edit tag “CurrentHour” to have the script “HourHandIncrement” execute when the value changes.

  8. Click on the hour hand object to open the Property Editor pane and bind the “HoursRot” tag to the Rotation under the Transform tab.

  9. Click on the minute hand object to open the Property Editor pane and blind the “MinutesRot” tag to the Rotation under the Location section.

  10. With the current configuration, when updating the value for CurrentHour and CurrentMin in the simulator, the scripts will now update the position of the hands on the clock accordingly.

  • No labels