View unanswered posts | View active topics It is currently Thu Aug 21, 2014 8:40 am






Reply to topic  [ 2 posts ] 
yet another programming issue 
Author Message
Rookie

Joined: Thu Nov 19, 2009 1:21 pm
Posts: 11
Post yet another programming issue
Ok so our only problem this time and hopefully our last is that when we push a button which gives us more power to the motors also disables our shooting mechanism.If the button is released the shooter works. For mor information we also puch a button to activate the joystick to control the shooter power. here is the code. I don't see any difference between the two statements for the shooter in fact they were copied over so I don't know why they don't work when the robot is in "boost." Thanks for your help.

#pragma config(Hubs, S1, HTMotor, HTServo, none, none)
#pragma config(Hubs, S2, HTMotor, HTServo, none, none)
#pragma config(Motor, mtr_S1_C1_1, motorLeft, tmotorNormal, openLoop, reversed)
#pragma config(Motor, mtr_S1_C1_2, motorRight, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S2_C1_1, thrower, tmotorNormal, openLoop, reversed)
#pragma config(Motor, mtr_S2_C1_2, motorG, tmotorNormal, openLoop)
#pragma config(Servo, srvo_S1_C2_1, launcher, tServoNormal)
#pragma config(Servo, srvo_S1_C2_2, scoopLeft, tServoNormal)
#pragma config(Servo, srvo_S1_C2_3, scoopRight, tServoNormal)
#pragma config(SrvoPosition, Position01, 242, 128, 128, 128, 128, 128, 128, 128)
#pragma config(SrvoPosition, Position02, 186, 128, 128, 128, 128, 128, 128, 128)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

#include "JoystickDriver.c"
task main()
{
while(true)
{
getJoystickSettings(joystick);

while(joy1Btn(5) != 1) // without boost
{

//single joystick control
motor[motorLeft] = (((joystick.joy1_y1*25)/-127) + (joystick.joy1_x1*25)/-127);
motor[motorRight] = (((joystick.joy1_y1*25)/-127) - (joystick.joy1_x1*25)/-127);

if(joy2Btn(6) != 1)
{
motor[thrower] = 0;

}

if(joy2Btn(6) == 1)
{
//variable thrower speed
motor[thrower] = ((joystick.joy2_y2*100)/-127);

}


if(joy2Btn(7) == 1)
{
servo[launcher] = 255;
servoChangeRate[launcher] = 0;
}



if(joy2Btn(5) == 1)
{
servo[launcher] = 186;
servoChangeRate[launcher] = 0;

}

if(joy1Btn(1) == 1)
{
servo[scoopLeft] = 0;
servo[scoopRight] = 255;
servoChangeRate[scoopLeft] = 0;
servoChangeRate[scoopRight] = 0;
}

if(joy1Btn(2) == 1)
{
servo[scoopLeft] = 245;
servo[scoopRight] = 10;
servoChangeRate[scoopLeft] = 0;
servoChangeRate[scoopRight] = 0;
}
}


while(joy1Btn(5) == 1) // with boost
{

// single joystick control
motor[motorLeft] = (((joystick.joy1_y1*75)/-127) + (joystick.joy1_x1*75)/-127);
motor[motorRight] = (((joystick.joy1_y1*75)/-127) - (joystick.joy1_x1*75)/-127);

if(joy2Btn(6) != 1)
{
motor[thrower] = 0;

}

if(joy2Btn(6) == 1)
{
//variable thrower speed
motor[thrower] = ((joystick.joy2_y2*100)/-127);

}


if(joy1Btn(1) == 1)
{
servo[scoopLeft] = 0;
servo[scoopRight] = 255;
servoChangeRate[scoopLeft] = 0;
servoChangeRate[scoopRight] = 0;
}

if(joy1Btn(2) == 1)
{
servo[scoopLeft] = 245;
servo[scoopRight] = 10;
servoChangeRate[scoopLeft] = 0;
servoChangeRate[scoopRight] = 0;
}


}

}
}


Tue Jan 19, 2010 6:32 pm
Profile
Rookie

Joined: Thu Nov 19, 2009 1:21 pm
Posts: 11
Post Re: yet another programming issue
Ok sorry but believe it or not it fixed itself. I was messing with something else and then it started working correctly.


Tue Jan 19, 2010 6:37 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 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.