View unanswered posts | View active topics It is currently Mon Nov 18, 2019 3:11 pm






Reply to topic  [ 2 posts ] 
Issue with bumper to limit arm travel 
Author Message
Rookie

Joined: Wed Feb 04, 2015 12:55 am
Posts: 2
Post Issue with bumper to limit arm travel
I'm putting together a program to control the arm travel when using the RC and it's not working correctly. Two bumpers limit the upper travel of the shoulder motor. I am building the program piece by piece so not to créate other issues. When I press the L up button the robot doesn't respond right away I have to press the button two or three times to get the arm to move up. I can't figure out why, please help. Here's the code written by the graphical RobotC interface :-(


task main()
{
repeat (forever) {
armControl(ShoulderMotor, BtnLUp, BtnLDown, 75);
armControl(ElbowMotor, BtnRUp, BtnRDown, 75);
while (getJoystickValue(BtnLUp) == 1) {
if (getBumperValue(BumpShouldUp) == 1) {
stopMotor(ShoulderMotor);
}
if (getBumperValue(BumpElbowUp) == 1) {
stopMotor(ShoulderMotor);
}
}
}
}


Fri Feb 06, 2015 12:08 am
Profile
Rookie

Joined: Wed Feb 04, 2015 12:55 am
Posts: 2
Post Re: Issue with bumper to limit arm travel
:-) I found a solution so I decided to post it here for everyone's benefit. If there is a better solution out there I hope to see it posted too.

repeat (forever) {
armControl(ShoulderMotor, BtnLUp, BtnLDown, 50);
armControl(ElbowMotor, BtnRUp, BtnRDown, 50);
while (getJoystickValue(BtnLUp)== 1) {
setMotor(ShoulderMotor, 50); // need to set motor again so it works within this while loop
if (getBumperValue(BumpShouldUp) == 1 || getBumperValue (BumpElbowUp) == 1) { // two bumpers limit this motor
stopMotor(ShoulderMotor);
waitUntil (getJoystickValue(BtnLUp) == 0); // need to wait with motor stopped until user releases button up
}
}
}


Mon Feb 09, 2015 1:33 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


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.