Re:Yes with "IF", No with else



if ( Bumper1 = 1 )

<< SNIP >>

if ( Bumper2 = 1 )

 << SNIP >>
 

One of the “Top 10 ‘C’ mistakes”… You are assiging ‘1’ to “Bumper1” and the same for “Bumper2”, assignments are usually equated to TRUE, so the ELSE never gets executed…

So try this:


 
 if ( Bumper1 == 1 )
 
 << SNIP >>
 
 if ( Bumper2 == 1 )
 
  << SNIP >>
  
 

MarkO
Thanks, that did it. I hope the other 9 top “C” mistakes aren’t that sneaky, or I’m in trouble. Again, I wish that someone would write “EasyC for Dummies”

IIRC, The Top 10 ‘C’ Mistakes was a chapter in the Borland Turbo ‘C’ 1.5 or 2.0 Manual (I am refering to the MS-DOS version of Turbo ‘C’ circa’ 1989), for Turbo Pacal Users switching to Turbo ‘C’ programming.

Now I should go and “dig it out” (the Turbo ‘C’ Manual) and recount them “all” (The Top 10 list) here…

We’ll get right on that! :smiley:

Here is good list check out the beginner section. Some of these don’t apply to easyC.

http://www.drpaulcarter.com/cs/common-c-errors.php

Excellent List!!!

Here is a few links to ‘C’ resources I have found as well, and of course, not all apply to EasyC or Embedded Systems in General:
Yes with “IF”, No with else (vexfan)