View unanswered posts | View active topics It is currently Tue Sep 16, 2014 6:07 am






Reply to topic  [ 4 posts ] 
Non-Working Varibles 
Author Message
Rookie

Joined: Wed Mar 09, 2011 7:35 pm
Posts: 6
Post 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.

_________________
Kyle Johnson
Booker T. Washington's BEST Robotics team.
Tuskegee, Alabama


Wed Mar 09, 2011 7:41 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post 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.


Wed Mar 09, 2011 7:50 pm
Profile
Moderator
Moderator
User avatar

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
Post 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.

_________________
sudo rm -rf /


Wed Mar 09, 2011 8:18 pm
Profile
Rookie

Joined: Wed Mar 09, 2011 7:35 pm
Posts: 6
Post Re: Non-Working Varibles
Thanks for trying to help, the problem was that the button commands weren't inside the 1==1 function.

_________________
Kyle Johnson
Booker T. Washington's BEST Robotics team.
Tuskegee, Alabama


Thu Mar 10, 2011 4:28 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.