How to Combine While Loop with Timer. Please help


#1

Hello everyone, I am newbie. I want to make a simple app.
I set time about 180 second count down.
I want make loop.
I want make them count to 0 then i want make next count about half of 180 = 90. i dont want it manually .
after that it will count to 0 then count down time reset . i will be half of 90 then so on
app will stop when count down time lower than 30.
I try many ways but i cant find a correct one.
Could you please help .
this is my .aia file and block
(PS: sorry my English is not good )

test.aia (3.1 KB)


#2

It’s very hard to understand what you want to do. Is there any other app that does what you want to do with yours? Can you provide an example?


#3

Thank you for your reply. this is my target .
i want phone run by it own .
first i give it number like 90.
then it will count down 90 to 0.
second time, it will count down 45 -0 ( second time the value is half the first one . this is just my rule )
third time. i will count down from 22.5 - 0 ( this the last time it finish because the value lower then 30 - this is other rule )

i know i can make 3 steps to do this but, i want to make app can do it by it own and loop many times as possible until it finishes.

I sorry i dont know any app or example for this case. i want to make this app to decrease the time my timer count.


#4

This should do what you want and allow you a little room to play with the initial settings.

I added a Reset button and some extra text to assist in the debugging output.

Half_Countdown.aia (4.5 KB)

EDIT: I didn’t see your follow up post… my example will start at 180, then 90, then 45, then stop because I set the “break” value to < 30. So three loops in total. Anyway, you can adjust it as you see fit.


#5

@ DocDrydenn Thank you so much. your block is awesome. it works , i changed a little bit follow my rule. this my version base on your block.

I can count to from lower than 30 to 0. like said before
this is my block and .aia file
Half_Countdownv2.aia (4.7 KB)


#6

No problem. I’m glad I was able to help you out.

EDIT: While I was writing/testing this, I got impatient having to wait the full 180 + 90 + 45 seconds each time I ran it, so I changed the clock interval to speed it up… anyway, I think I forgot to reset it. Just adjust the clock interval back to 1000 in design view and the speed will be correct.