getting my sequencer BPM conform

could you give me an example how I can use the above code to act as a timer and set the main frequncy to
120BPM on 8 steps?