View Single Post
  #2   Spotlight this post!  
Unread 30-01-2008, 08:02
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: ir sensor Board ??????????????????????

Quote:
Originally Posted by darkdwarven View Post
Code:
if (rc_dig_in07 = 0)
This tries to assign the value 0 to the rc_dig_in07 variable. It also has the side effect of never being true. You want instead to test for equality.

In short, replace the = with ==.

Some people use the technique of always putting the constant on the left in a test like this. That way the compiler will notice and complain if you accidentally use a single equals sign.

Oh, and your test is backwards. The IR receiver board outputs 0 when nothing is detected, and gives a 100 millisecond 1 pulse when a valid signal is received.

Last edited by Alan Anderson : 30-01-2008 at 08:05.