|
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: 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.
|