To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.org.ca.rtltorontoOpen lugnet.org.ca.rtltoronto in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Organizations / Canada / rtlToronto / 438
437  |  439
Subject: 
Re: What I learned @ the robot meet
Newsgroups: 
lugnet.org.ca.rtltoronto
Date: 
Wed, 28 Feb 2001 17:12:56 GMT
Viewed: 
511 times
  
Rebel Transcanner wrote:

"Chris Magno" <cmagno@home.com> wrote in message
news:3A900923.7A053E68@home.com...

What lego related stuff did you learn at the event.

One of the things I learned (which shocked me) about programming:

OnFwd(OUT_B+OUT_B)

does NOT just turn on (forward) output B. It will turn on output B *AND* C.
SHOCKED. That's messed up!


Actually, I think it will just turn on output C, and leave B on if
it was already.  A much better way to write this sort of thing, in
general, is to use the bitwise OR operator instead of addition.  Then
that kind of mistake can't happen:

OnFwd(OUT_B | OUT_B);

I can go into the math of this if anyone cares; otherwise, I think NQC
supports '|', so use it in good health!

Jeff



Message is in Reply To:
  Re: What I learned @ the robot meet
 
"Chris Magno" <cmagno@home.com> wrote in message news:3A900923.7A053E...ome.com... (...) One of the things I learned (which shocked me) about programming: OnFwd(OUT_B+OUT_B) does NOT just turn on (forward) output B. It will turn on output B *AND* (...) (24 years ago, 18-Feb-01, to lugnet.org.ca.rtltoronto)

3 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR