Hourly Tower Bells

Touch Portal Snippets

This button starts a sequence that will play tower bells at each full hour and will play them the hour amount of times. So if it is four o'clock it will play the sound 4 times.

The Actions

On Press

We want to start this button only once during the entire time Touch Portal is running. So we first check if the button is off and if it is we will run the flow of actions. If it is the first thing we do is turning the button state to on. This ensures that this button will never run this flow of actions anymore when it is pressed again as the first IF statement will fail of course.

As we want it to continue for a long period of time we set the repeat to a very big number. At the end of the repeat we wait 1 minute which will basically repeat this loop every minute.

First thing we do inside the loop is to check if we are at the whole hour. We just get the current time and check if the minute of the current hour is zero, which indicates the whole hour. If it is we will start the sound playing.

We first retrieve the time in an 12 hour format because we then can extract the amount of times the sound should play more easily. Then we replace everything except the hour part to nothing, which will result in the Value 1 holding the hour only. Then we use that Value 1 to play the sound the amount of times of the current hour. Between the sound playbacks we have 3 seconds to give it a bit of room and a realistich timing.

Back to Guide Overview