Page 1 of 1

Conditional branching

Posted: 21 Oct 2018 10:08
by 6j71ma
Hi all, new to automatic (AM), I come from macrodroid (MD).
AM is much more reliable than MD, so I'm considering moving to AM.
But I need to get used to AM programming and there are still so many doubts!
The 1st one is conditional branching. Back in MD I could use WHILE REPEAT and IF THEN ELSE conditions, and these don't seem to be there in AM (to be fair, I discovered AM yesterday).
Here is an example : trigger is incoming call, and I want to toggle on and off the flashlight while the phone is ringing. I can choose every action, but how do i set a loop to toggle the flashlight until I answer the phone?
Besides that there are other problems, but one at the time! And congrats to AM developers, it's a great utility.

Re: Conditional branching

Posted: 21 Oct 2018 10:09
by 6j71ma
Just to clarify : I want to toggle the torch on and off every 500 Ms, while the phone is ringing only.

Re: Conditional branching

Posted: 21 Oct 2018 11:00
by Martin
Hi,

You can add branches to a flow by adding a condition to a flow and then connect the true/false-branches to different actions. You can find an example here: Flow list, open the Menu: Catalog->Location Based WiFi On/Off.
You can also build loops by using a condition. Check out example Countdown from the catalog.

Regards,
Martin

Re: Conditional branching

Posted: 21 Oct 2018 11:03
by Rafi4
Hi
Simply download all flows in forum. Study them. You can easily learn more quickly.this is the flow which is required to you. Any doubts?
Post.

Re: Conditional branching

Posted: 21 Oct 2018 18:17
by Desmanto
Welcome on board. You can loop the element by dragging back the element back to its previous one. In this case you want to loop the flash light on - sleep - flash light off - sleep >> loopback to flashlight on. But you want to check in middle, whether the phone is still ringing. So add condition Call State : Ringing.

There is similar concept here : viewtopic.php?f=5&t=7573&p=22143&hilit= ... ent#p22143
Except, replace the speech output with the flash light on/off loop (4 elements)

Re: Conditional branching

Posted: 21 Oct 2018 22:35
by 6j71ma
I'm confused and amazed at the same time.
Thanks for your help!
Sure I will try most of the flows, I need to learn Automagic idiosyncrasies