
Re: joystick buttons problem
Unnecessary explanation:Assuming ROBOTC 1.4 works the same as more recent versions, the reason is that joystick buttons are stored as bit fields (button 1 is stored in first bit, button 2 is stored in the second bit, etc). The joy1Btn function then selects out the appropriate button, like:
This means that joy1Btn(2) == 2 when button 2 is pushed; it's not equal to 1 (joy1Btn(3) would equal 4). Since in C, any non-zero number evaluates to true, you don't have to do the comparison.
Recent versions of ROBOTC produce more consistent behavior by changing the definition of joy1Btn slightly:
which produces a 1 when the button is pushed, regardless of the button.