Page 1 of 1

Math with Variable

Posted: Thu Mar 21, 2019 11:01 pm
by JLeith
Hello All
Getting stumped on the symbol for being able to have two variables take the same decision route

I have a Variable called ( HM ) and another called ( VM ) and I can't figure how to have them both take the route.

I could have HM at 25 and then get VM at 25 a little later and the message is the same for both.

Would save the coding with combined

Here is a snap shot drawing

John

Re: Math with Variable

Posted: Fri Mar 22, 2019 8:03 am
by mnf
Create a new macro that takes the switch variable as an argument.

Then call new_macro (VM) and new_macro (HM)

Martin

Re: Math with Variable

Posted: Fri Mar 22, 2019 4:21 pm
by JLeith
Thank you Martin

I have my program working with the 2 routes I was thinking if there was a ( "OR" ) logic in flowcode
Making it use either of the Variables for 1 route.

All the best
John

Re: Math with Variable

Posted: Fri Mar 22, 2019 6:13 pm
by medelec35
Hi John,
What about just adding another variable?
HM OR VM.png
(4.6 KiB) Downloaded 2590 times

Re: Math with Variable

Posted: Fri Mar 22, 2019 10:23 pm
by JLeith
Excellent info Martin

So the HM | VM is a "OR" statement

Off to give it a go

John

Re: Math with Variable

Posted: Sat Mar 23, 2019 11:40 am
by medelec35
JLeith wrote:Excellent info Martin
Not a problem, hopefully it's waht you are after?
JLeith wrote:So the HM | VM is a "OR" statement
Yes it it is.
When changing bits:
Bitwise Operators.png
(69.89 KiB) Downloaded 2569 times
Above is from tutorialspoint
If using a logical then use two lots instead of one.
e.g &&, || etc.

Let us know if it works or not?

Re: Math with Variable

Posted: Thu Mar 28, 2019 11:23 pm
by JLeith
Hi Martin
I did the HM | VM and set Variable

Ran into a glitch.... Had to go back to HM and VM
If I came into HM with say 25 and have a code to stop playing the MP3 if the HM says at 25 and the VM goes up.

The hitch came wen HM was at 25 and the VM reached 25 the MP3 file would play due to stop code for HM affect the VM state.

It did work if HM and VM detection.

John

Re: Math with Variable

Posted: Fri Mar 29, 2019 6:49 am
by medelec35
If it fails on one condition then the code within decision branch can be altered to deal with that condition.
So long as you know what you want to happen should that condition occur.