ROBOTC.net forums
http://www.robotc.net/forums/

Please need help, no buttons work
http://www.robotc.net/forums/viewtopic.php?f=63&t=7816
Page 1 of 1

Author:  Saints768 [ Wed Jan 29, 2014 9:14 pm ]
Post subject:  Please need help, no buttons work

#include "JoystickDriver.c"

task main()
{
while(1 == 1)
{
getJoystickSettings(joystick);

motor[motorWright] = joystick.joy1_y1; // Motor D is assigned a power level equal to the right analog stick's Y-axis reading.
motor[motorWleft] = joystick.joy1_y2; // Motor E is assigned a power level equal to the left analog stick's Y-axis reading.


if(joy1Btn(4) == 1)
{
motor(motorAright) = -100;
}
else if (joy1Btn(7) == 1)
{
motor(motorAright)= 100;
}
else
{
motor(motorAright)= 0;
}

if(joy1Btn(4) == 1)
{
motor(motorAleft) = -100;
}
else if (joy1Btn(7) == 1)
{
motor(motorAleft)= 100;
}
else
{
motor(motorAleft)= 0;
}


if(joy1Btn(1) == 1)
{
servo(servo1) = 256;
}
else if (joy1Btn(2) == 1)
{
servo(servo1)= 0;
}
else
{
servo(servo1)= 127;
}

}








}

This is my code, for some reason none of the joysticks, nor joystick buttons work. They used to but now it does not for some reason. I was hoping someone here can help me. Please and thank you.

Author:  Saints768 [ Thu Jan 30, 2014 12:44 am ]
Post subject:  Re: Please need help, no buttons work

Anybody ? :(

Author:  MHTS [ Thu Jan 30, 2014 4:28 am ]
Post subject:  Re: Please need help, no buttons work

Have you opened the joystick dialog? If so, do the buttons on the picture respond to your pressing of them?

Author:  Saints768 [ Thu Jan 30, 2014 4:35 am ]
Post subject:  Re: Please need help, no buttons work

Yes I have and every button works

Author:  MHTS [ Thu Jan 30, 2014 4:47 am ]
Post subject:  Re: Please need help, no buttons work

Code:
#include "JoystickDriver.c"

task main()
{
    while(1 == 1)
    {
        getJoystickSettings(joystick);

        motor[motorWright] = joystick.joy1_y1;         // Motor D is assigned a power level equal to the right analog stick's Y-axis reading.
        motor[motorWleft] = joystick.joy1_y2;         // Motor E is assigned a power level equal to the left analog stick's Y-axis reading.

        if(joy1Btn(4) == 1)
        {
            nxtDisplayTextLine(1, "Btn4");
            motor(motorAright) = -100;
            motor(motorAleft) = -100;
        }
        else if (joy1Btn(7) == 1)
        {
            nxtDisplayTextLine(1, "Btn7");
            motor(motorAright)= 100;
            motor(motorAleft) = 100;
        }
        else
        {
            nxtDisplayTextLine(1, "");
            motor(motorAright)= 0;
            motor(motorAleft) = 0;
        }

        if(joy1Btn(1) == 1)
        {
            nxtDisplayTextLine(2, "Btn1");
            servo(servo1) = 256;
        }
        else if (joy1Btn(2) == 1)
        {
            nxtDisplayTextLine(2, "Btn2");
            servo(servo1)= 0;
        }
        else
        {
            nxtDisplayTextLine(2, "");
            servo(servo1)= 127;
        }

        wait1Msec(100);
    }
}

How about this code? What does the LCD display say?

Author:  Saints768 [ Thu Jan 30, 2014 4:08 pm ]
Post subject:  Re: Please need help, no buttons work

it says
Ext Batt: 3.0 V
nxt batt: 7.5 V
FMS mssgs: 0
teleop filename:

also its blinking wait for start and its blinking even tho i already pressed start

Author:  BurningLights [ Thu Jan 30, 2014 7:59 pm ]
Post subject:  Re: Please need help, no buttons work

Saints768 wrote:
it says
Ext Batt: 3.0 V
nxt batt: 7.5 V
FMS mssgs: 0
teleop filename:

also its blinking wait for start and its blinking even tho i already pressed start


Ah, sounds like you need to use the "Joystick Control - Competition" debug window. Use that one for joystick control, and make sure you select the "Teleop - Running" radio button. (You'll have to select "Teleop - Ready" first.)

Author:  MHTS [ Thu Jan 30, 2014 9:55 pm ]
Post subject:  Re: Please need help, no buttons work

Saints768 wrote:
it says
Ext Batt: 3.0 V
nxt batt: 7.5 V
FMS mssgs: 0
teleop filename:

also its blinking wait for start and its blinking even tho i already pressed start

Ah, sounds like you need a new battery. Ext Batt is about 12V. 3.0V is extremely low.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/