Math with Variable

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

Math with Variable

Postby JLeith » Thu Mar 21, 2019 11:01 pm

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
Attachments
HM or VM.png
HM or VM.png (30.61 KiB) Viewed 1667 times

mnf
Valued Contributor
Valued Contributor
Posts: 608
Joined: Wed May 31, 2017 11:57 am
Has thanked: 56 times
Been thanked: 336 times
Contact:

Re: Math with Variable

Postby mnf » Fri Mar 22, 2019 8:03 am

Create a new macro that takes the switch variable as an argument.

Then call new_macro (VM) and new_macro (HM)

Martin

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

Re: Math with Variable

Postby JLeith » Fri Mar 22, 2019 4:21 pm

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

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8485
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2441 times
Been thanked: 3500 times
Contact:

Re: Math with Variable

Postby medelec35 » Fri Mar 22, 2019 6:13 pm

Hi John,
What about just adding another variable?
HM OR VM.png
HM OR VM.png (4.6 KiB) Viewed 1639 times
These users thanked the author medelec35 for the post:
JLeith (Fri Mar 22, 2019 10:21 pm)
Rating: 5.26%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

Re: Math with Variable

Postby JLeith » Fri Mar 22, 2019 10:23 pm

Excellent info Martin

So the HM | VM is a "OR" statement

Off to give it a go

John

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8485
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2441 times
Been thanked: 3500 times
Contact:

Re: Math with Variable

Postby medelec35 » Sat Mar 23, 2019 11:40 am

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
Bitwise Operators.png (69.89 KiB) Viewed 1618 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?
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

Re: Math with Variable

Postby JLeith » Thu Mar 28, 2019 11:23 pm

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

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8485
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2441 times
Been thanked: 3500 times
Contact:

Re: Math with Variable

Postby medelec35 » Fri Mar 29, 2019 6:49 am

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.
These users thanked the author medelec35 for the post:
JLeith (Mon Apr 01, 2019 5:11 pm)
Rating: 5.26%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.