Arduinos program has A bitread function..
How do you perform this task in flowcode?
http://arduino.cc/en/Reference/BitRead
BitRead Function
Moderator: Benj
- outlawstc
- Posts: 32
- Joined: Tue Oct 15, 2013 6:14 pm
- Has thanked: 12 times
- Been thanked: 9 times
- Contact:
BitRead Function
"If your having code problems I feel bad for you son... I got 99 problems but a glitch ain't one"
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: BitRead Function
There are a few posts on this.
http://www.matrixmultimedia.com/mmforum ... 618#p53618
&
http://www.matrixmultimedia.com/mmforum ... =36&t=7451
are a couple of them
Martin
http://www.matrixmultimedia.com/mmforum ... 618#p53618
&
http://www.matrixmultimedia.com/mmforum ... =36&t=7451
are a couple of them
Martin
Martin
- outlawstc
- Posts: 32
- Joined: Tue Oct 15, 2013 6:14 pm
- Has thanked: 12 times
- Been thanked: 9 times
- Contact:
Re: BitRead Function
I brought this over to there topic just to make it simple on others who may seek the same answer.. Thanks again medelec35
medelec35 wrote:For my 2 pence worth.
How I check is a bit is set or clear:
(Variable & (1 << bit)) <> 0 // to Check if bit of variable is set
or
(Variable & (1 << bit)) = 0 // to Check if bit of variable is Clear
So if you want to see if bit 2 is Clear:
If (Variable & (1 << 2)) = 0 then it's clear
If you want to see if bit 2 is Set:
If (Variable & (1 << 2)) <> 0 then it's set
Also if you want to set a bit:
Variable = Variable |(1<<bit)
To clear a bit:
Variable = Variables &~(1<<bit)
Martin
"If your having code problems I feel bad for you son... I got 99 problems but a glitch ain't one"