Using modulus

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

Moderators: Benj, Mods

Post Reply
Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Using modulus

Post by Ondra »

Good day all. I would like to know when checking for a remainder using modulus is this correct: -
"var MOD 2 =0"? This would check for even numbers. If this is not right could someone give an example.
Thanks in advance

Ondra

chevy6600
Flowcode V4 User
Posts: 115
Joined: Fri Feb 22, 2008 6:38 pm
Contact:

Re: Using modulus

Post by chevy6600 »

Hi ondra, i used it in my servo program , this is what i used :

servo_val = ( servo_pos[port_counter] )
servo_l = ( servo_val MOD 3 ) * 85
servo_h = 31 + ( servo_val / 3 )

chevy6600
Flowcode V4 User
Posts: 115
Joined: Fri Feb 22, 2008 6:38 pm
Contact:

Re: Using modulus

Post by chevy6600 »

Hi ondra, i thought i would go one better than my last post. i have put a demo simple maths routine together, dowload the program `mod` and just run it so that you can see flowcode variables.
Attachments
mod.fcf
(3.5 KiB) Downloaded 324 times

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: Using modulus

Post by Ondra »

Thanks.

Post Reply