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

Non-Working Varibles
http://robotc.net/forums/viewtopic.php?f=11&t=3101
Page 1 of 1

Author:  yuukikaihou [ Wed Mar 09, 2011 7:41 pm ]
Post subject:  Non-Working Varibles

In the code, only the anolog sticks preform actions, any other varibale names do not do anything. The premade code worked perfectly including the anolog sticks and buttons.

Code:
task main ()
{

while(1 == 1)
{
    motor[leftMotor]  = vexRT[Ch3];   // Left Joystick Y value
    motor[rightMotor] = vexRT[Ch2];   // Right Joystick Y value
    motor[Armmotor]  = vexRT[Btn5U];   //Up Button(Group 5)
   motor[Grippermotor] = vexRT[Btn6U];   //Up Button(Group 6)
}

  // Button Control:
 if(vexRT[Btn6U] == 1)      //If button 6U is pressed:
  {
    motor[port5] = 32;         //run motor port 5 at quarter speed (i.e. lift arm)
  }
  else if(vexRT[Btn6D] == 1) //If button 6D is pressed:
  {
    motor[port5] = -32;        //run motor port 5 at quarter speed reversed (i.e. lower arm)
  }
}


leftMotor & rightMotor work as they are supposed to, yet Armotor & Grippermotor give no response. In ROBOTC there are no warnings/errors. Also leftMotor, rightMotor, Armmotor and Grippermotor are all defined to save any speculation.

What am I missing?
Thanks.

Author:  MHTS [ Wed Mar 09, 2011 7:50 pm ]
Post subject:  Re: Non-Working Varibles

I am not familiar with vex controller but if Btn5U and Btn6U are buttons, I assume they will give you either a value of 1 or 0. If you assign a 1 or 0 to the motors, the motors won't really move much since the motor range is -100 to 100. A value of 1 is hardly anything.

Author:  magicode [ Wed Mar 09, 2011 8:18 pm ]
Post subject:  Re: Non-Working Varibles

MHTS is right. On the VEX Joystick that works with the cortex, the buttons return true or false(1 or 0). You may be getting confused because on the previous controller, the buttons would return 127 or -127. The button control code that you have written looks to be fine though. Just replace 'port5' with your motor names.

Author:  yuukikaihou [ Thu Mar 10, 2011 4:28 pm ]
Post subject:  Re: Non-Working Varibles

Thanks for trying to help, the problem was that the button commands weren't inside the 1==1 function.

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