Subject:
|
Re: Boolean operators in IC
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Thu, 16 Sep 1999 04:21:21 GMT
|
Original-From:
|
Will Hein <WFH@ANDREW.CMUstopspam.EDU>
|
Viewed:
|
938 times
|
| |
| |
Booleans work the same as in most languages. If you want to test for a
certain condition or set of conditions, then break it down into things that
can be answered as true or false.
You can use equalities, such as:
if (sky == blue) printf ("you're on earth") ;
if (sky != blue) printf ("you're not on earth") ;
you can use realtionship tests such as:
if ( franks_age <= bobs_age ) <some code here>;
if ( franks_age >= bobs_age ) <some code here>;
you can also force conditions, such as
while (0==0) <some code here>;
Some things that I usually use booleans for are testing if an analog sensor
is above or below a certain level, a switch is depressed, or a loop has
executed the desired number of times.
Hope that helps.
-Will Hein
"Smile. It makes people wonder what you've been up to."
|
|
1 Message in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|