Go to Post Cooler robots = Impressed sponsors = More money for FIRST = Easier expansion = Easier culture change. Isn't this what we want? - Karthik [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 16-04-2010, 17:21
krudeboy51's Avatar
krudeboy51 krudeboy51 is offline
Only Programmer
AKA: kory
FRC #0369 (369)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2010
Location: brooklyn
Posts: 151
krudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of light
Send a message via AIM to krudeboy51
CAN ANYONE HELP ME PLEASE??

I wrote a this code for our arm release:

Quote:
if ( (ThirdStick->GetRawButton(6) ) )

{
ArmRelease -> Set(1.0);
}
else
{
ArmRelease->Set(0.0);
}


if ( (ThirdStick->GetRawButton(7) ) )
{
ArmRelease ->Set(-1.0);
}
else
{
ArmRelease->Set(0.0);
}
this means when i press buton 6 on the joystick the motor is supposed to go forward, and when i press button 7 on the joystick the motor is supposed o go backwards. button 6 work, the motor goes forward, but when i press button 7 it doesnt move. i even tried:

Quote:
if ( (ThirdStick->GetRawButton(6) ) )

{
ArmRelease -> Set(1.0);

while (ThirdStick->GetRawButton(7)
{
ArmRelease->Set(-1.0);
}
}
else
{
ArmRelease->Set(0.0);
}
but it still dont work!
Reply With Quote
  #2   Spotlight this post!  
Unread 16-04-2010, 17:30
Radical Pi Radical Pi is offline
Putting the Jumper in the Bumper
AKA: Ian Thompson
FRC #0639 (Code Red Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York
Posts: 655
Radical Pi has a spectacular aura aboutRadical Pi has a spectacular aura aboutRadical Pi has a spectacular aura about
Re: CAN ANYONE HELP ME PLEASE??

Huge flaw in your code. Here's a hypothetical situation based on the first one shown:

Button is 6 is pressed. The motor is set to 1.0. However, almost immediately after that, button 7 is checked and most likely set to 0.0.

Here's what I think you want:

Code:
if (ThirdStick->GetRawButton(6)) {
    ArmRelease->Set(1.0);
} else if (ThirdStick->GetRawButton(7)) {
    ArmRelease->Set(-1.0);
} else {
    ArmRelease->Set(0.0);
}
Also, I assume you mean if instead of while in that second code block. That version would only activate button 7 mode if button 6 was pressed
__________________

"To have no errors would be life without meaning. No strugle, no joy"
"A network is only as strong as it's weakest linksys"
Reply With Quote
  #3   Spotlight this post!  
Unread 16-04-2010, 17:38
krudeboy51's Avatar
krudeboy51 krudeboy51 is offline
Only Programmer
AKA: kory
FRC #0369 (369)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2010
Location: brooklyn
Posts: 151
krudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of lightkrudeboy51 is a glorious beacon of light
Send a message via AIM to krudeboy51
Re: CAN ANYONE HELP ME PLEASE??

Quote:
Originally Posted by Radical Pi View Post
Huge flaw in your code. Here's a hypothetical situation based on the first one shown:

Button is 6 is pressed. The motor is set to 1.0. However, almost immediately after that, button 7 is checked and most likely set to 0.0.

Here's what I think you want:

Code:
if (ThirdStick->GetRawButton(6)) {
    ArmRelease->Set(1.0);
} else if (ThirdStick->GetRawButton(7)) {
    ArmRelease->Set(-1.0);
} else {
    ArmRelease->Set(0.0);
}
Also, I assume you mean if instead of while in that second code block. That version would only activate button 7 mode if button 6 was pressed
THANKS ALOT MAN!!!!, I FORGOT ALL ABOUT ELSE IF STATEMENTS
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I'm Starting a Team, Can you help me please? Leav FIRST Lego League 2 14-09-2006 15:14
can anyone please tell mw where or with what can i lear programing in C techsage Programming 7 23-08-2005 00:25
please help! anyone not using Filemaker Quentinfool Scouting 0 04-02-2003 21:53
Can Anyone Help????? archiver 1999 0 23-06-2002 22:58
Can anyone help me??? archiver 2001 1 23-06-2002 22:17


All times are GMT -5. The time now is 15:18.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi