I am trying to insert a code snippet that allows users to call up a countdown timer via a keypress. The countdown should start at 15 and reset itself to 15 once it hit 0. However, currently it goes into the negative after 0.
So far I have inserted:
timer = core.CountdownTimer()
under the tab ‘before experiment’,
and then:
timer.add(15)
if timer == 0:
timer.add(15)
under the ‘begin experiment’ tab.
I don’t have any coding experience, so probably this is a really dumb approach. I appreciate your help! Thanks!
Thank you so much for the suggestion! The issue with this is that the routines are very brief (there is a loop for the routine, so each routine lasts about 3sec). So if I insert the code into the ‘begin routine’ tab it means that the countdown returns to 15 at the start of each routine, rather than ever reaching 0. The countdown should run continuously, irrespective of the routine repetitions. Does that make sense at all?
Again, many thanks!