Hey guys I need help. I’m a novice programmer as you can tell and am using easyC. In my program I have it set up so if I press a button on the joystick is sends a value (1) to a variable. I then have an if statement saying if this variable == 1 then proceed. However whenever I press the button sending the value it seems like the variable stays locked to 1 and it won’t go back to 0 like a normal joystick to digital. I need to know how to get the joystick to send a value of 0 when it isn’t pressed. If there is another way to get a value to a variable via joystick please help me.
It looks kinda like this
int | btn
while (1)
(
btn = GetJoystickDigital (1, 6, 2) \ (sorry no forward slashes) It stays locked on 1 after this.
Get joystick digital returns as there or not there. in your if statement, it should be
if (btn)
{
do something…
}
if you look at a potentiometer block, you will notice that it returns as a type of variable, but a ‘get joystick digital’ block returns as nothing. for your variable type in the define variables part of your program, you should use “char”