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 2 Next »

Creating an Analog Clock

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

  2. Create a clock interface manually or search “3D Silver Clock” in the Graphic 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 Graphic Library, then drag and drop the image to the page.

  4. Once the clock has been created, the user will need to 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.

The ‘RTC’ script should be configured to run on startup from the script properties window, the other two scripts should be configured to run when manually called. Next, the user can configure the ‘MinuteHandIncrement’ script to run when the tag ‘CurrentMin’ changes values. A similar setup can be applied for the ‘HourHandIncrement’ script and the ‘CurrentHour’ tag as shown in the below screenshot.

Lastly, the user will need to bind the rotation of the clock hands to the ‘HoursRot’ and ‘MinutesRot’ tags, as shown in the below images.

With the current configuration, the scripts will now update the position of the hands on the clock to match the current time.

  • No labels