Flicker/blinking stimulus at a set frequency

Dear psychopy community,

Objective:
Given an input, a frequency range between 10 to 30 Hz, the stimulus to flicker/blinks at that given frequency.

What has been tried so far:

Building upon this thread, which discussed how to make an object blinks, I would like that object to blink at a given frequency, for example, 10 Hz.

Understand that, there is the variable t, that is time in seconds. Also, we can use sin and if-else functions to determine when to show and hide the stimulus with 1 and 0 respectively. As such, I input 1 if sin(t*10) > 0 else 0 into the Opacity field. This enables the stimulus to flicker.

What is the formula to convert from time in seconds + sine + (any other functions that are supported), to ensure that this stimulus flicker at 8 Hz, 10 Hz or any Hz as desired?

You should probably be thinking in terms of the discrete number of frames elapsed rather than time.