Troubles with timer

Hello!
I’m trying to build a metronome, but when i want that the app thick every teme the timer1 fires, i get an error. here the screenshot.


in the designer page i set the sound1.source with tick.mp3
can someone help me?

Thx

My guess is that your sound (tick.mp3) might have a duration longer than the delay (500 or 600 ms). Here is a version I recreated with a very short tick.mp3 that seems to function fine if you want to use it as a starting point or compare it to yours:

https://x.thunkable.com/copy/f5d8a9dc05dc60ba2348aa9495847b6f

Hope that helps!


EDIT Also, here is a version that uses a slider and one play/pause button. I was just playing around and came up with it, thought it might be of use for learning.

https://x.thunkable.com/copy/a6b991eeed7b2edbe01545902a3dbd91

1 Like

i tried you apps but i get an error on the phone… the apps crashes when i press play… no idea

The error is caused by the TimerSetIntervalMilliseconds block. Remove them from the project.

thanks artech, i tried what you say and it works, but in the moment i want to change the millisecond interval by click the 120bpm button, the app crashes. i want just have an app where i can start and stop the tick.mp3 and change the bpm from 100 to 120 bpm…

Unfortunately, when using Android, you have to temporarily use this method - create a separate timer for each frequency and select the desired timer in the application. This is a terrible decision, but so far only so.

i tried to use 2 different timers (one with 500ms and the other with 600ms interval) but it doesnt work…
here the screenshot

“but it does not work …”

Can you tell me in more detail what does not work? Is the application crashes or does the metronome sound not play? Timer.loops= true? “If” blocks are triggered when the buttons are pressed?

ah sorry :-)))
both timeloops are enabled but when i click the 100 button the 100bmp timer starts correctly, when i press the 120 bmp button the 120 tier doesnt start and i can hear only the sound event generated from the 100 timer…

Check it

https://x.thunkable.com/projects/5b58a54d1400586f65c8d218/project/properties/designer/

Does this example work for you?

1 Like

wow amazing! it works perfectly!!!