Hello,
I am trying to display a LED on a every bit of every port sequentially.
To keep from having more than 1 led at a time on, I want to rule out all odd numbers.
Display 1 then 2, then 4, etc, on every port. The program is not complete i am aware, but I know that
nothing is going to work as I want the way it is.
Please look at the switch on the switch in macro "A". That is where I am not sure how to get the switch to choose 1 or 2
depending on an odd or even number.
If anyone can help me with this, I would appreciate it.
Program attached.
Thanks in advance.
Using Switch to choose a calculation output.
Moderator: Benj
- E*2Engineer
- Posts: 35
- Joined: Wed Dec 25, 2013 6:54 pm
- Has thanked: 12 times
- Been thanked: 6 times
- Contact:
Using Switch to choose a calculation output.
- Attachments
-
- PROGRAMMING SOCKET TEST 1 10 17 0038.fcfx
- Question is on macro A,
- (25.02 KiB) Downloaded 251 times
- E*2Engineer
- Posts: 35
- Joined: Wed Dec 25, 2013 6:54 pm
- Has thanked: 12 times
- Been thanked: 6 times
- Contact:
Re: Using Switch to choose a calculation output.
Thank you for the reply,
But I just don't understand the A & 1 portion. Is there still a fmod in the program?
Or did you manage to remove that.
It seems you are treating 1 as a variable..........
Please send code with response.
Sorry, for the ignorance, I am new to what you are doing. NOT a Trump voter............
But I just don't understand the A & 1 portion. Is there still a fmod in the program?
Or did you manage to remove that.
It seems you are treating 1 as a variable..........
Please send code with response.
Sorry, for the ignorance, I am new to what you are doing. NOT a Trump voter............
- E*2Engineer
- Posts: 35
- Joined: Wed Dec 25, 2013 6:54 pm
- Has thanked: 12 times
- Been thanked: 6 times
- Contact:
Explanation required on solution from LeighM
http://www.matrixtsl.com/mmforums/viewt ... 63&t=18457
The solution Leigh posted I did not really understand.
Could someone could give me some further help?
Please insert what he had in mind into my code attached, so I can single step through it and learn it.
Thank You.
The solution Leigh posted I did not really understand.
Could someone could give me some further help?
Please insert what he had in mind into my code attached, so I can single step through it and learn it.
Thank You.
- Attachments
-
- PROGRAMMING SOCKET TEST 1 10 17 1743.fcfx
- (25.21 KiB) Downloaded 255 times
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: Explanation required on solution from LeighM
Combining this message with your original question.
Means perform a bitwise AND operation on A with the number 1. The result of this operation is equal to zero (decision branch NO) if A is even and equal to 1 (decision branch YES) if A is odd. See wikipedia for an explanation on bitwise operators.
To use it in your program just input the code shown above in the condition of the decision icon.
Code: Select all
A & 1
To use it in your program just input the code shown above in the condition of the decision icon.
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
- E*2Engineer
- Posts: 35
- Joined: Wed Dec 25, 2013 6:54 pm
- Has thanked: 12 times
- Been thanked: 6 times
- Contact: