View Single Post
  #56   Spotlight this post!  
Unread 17-03-2004, 21:37
Xufer's Avatar
Xufer Xufer is offline
8 Seasons and as stable as ever
AKA: Working, 2/4 degrees complete still schooling...
FRC #1740 (The Cyber Colonels)
Team Role: Engineer
 
Join Date: Jan 2003
Rookie Year: 1999
Location: Waterford, CT
Posts: 231
Xufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to behold
Send a message via AIM to Xufer Send a message via MSN to Xufer Send a message via Yahoo to Xufer
Re: quick question: TIMERS

Quote:
Originally Posted by Alan Anderson
That's because you've fallen into a common trap with the c language's syntax. Testing for equality is done with the == "is equal" operator, and you've instead used the = "assignment" operator. Your code assigns the value "1" to the variable "rc_dig_in18", and then tests the result -- which is always 1, interpreted as true by the software.

What your first line should say instead is this:
Code:
if (rc_dig_in18==1)	{
Or you could leave off the explicit test for 1, and let c's boolean rules work for you:
Code:
if (rc_dig_in18)	{
That should take care of the problem you're having.
mmk thnx, but j/w how would i do it if i was to have like 4 auton modes i have a sitch box that will occupy 6 dig_in's
__________________


If saftey is first and i put FIRST ahead of everything, then i must be the safest guy in the world.

Team 521 Alumni -- Team 1740 Mentor-- Go Go 1740!
Sometimes I think I've been doing this too long and other times I think I haven't done this enough... but all the times I'm sure I'm crazy
Photonics, It's Your Future

Last edited by Xufer : 17-03-2004 at 21:39.