Ok i'm kinda new to this so I could use a little help PLEASE!!
In Tank Drive our accessory motors for our lift and our arm jerk in both directions.
This is motor H and I can some one look over and make sure Im not missing something. Also put a volt meter on the controller brick getting about 9v in one direction 3.2v on the other. If motor plugged to 12v runs great in either direction.
#pragma config(Hubs, S1, HTMotor, HTMotor, none, none)
#pragma config(Hubs, S4, HTMotor, none, none, none)
#pragma config(Sensor, S1, , sensorI2CMuxController)
#pragma config(Sensor, S4, , sensorI2CMuxController)
#pragma config(Motor, mtr_S1_C1_1, motorD, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C1_2, motorE, tmotorTetrix, openLoop, reversed)
#pragma config(Motor, mtr_S1_C2_1, motorF, tmotorTetrix, openLoop, reversed)
#pragma config(Motor, mtr_S1_C2_2, motorG, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S4_C1_1, motorH, tmotorTetrix, PIDControl)
#pragma config(Motor, mtr_S4_C1_2, motorI, tmotorTetrix, PIDControl)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
/*--------------------------------------------------------------------------------------------------------*\
|* *|
|* - Tetrix Quiet Tank Drive - *|
|* ROBOTC on Tetrix *|
|* *|
|* This program allows you to drive a robot via remote control using the ROBOTC Debugger. *|
|* This particular method uses "Tank Drive" where each side is controlled individually like a tank. *|
|* This program also ignores low values that would cause your robot to move when the joysticks fail to *|
|* return back to exact center. You may need to play with the 'threshold' value to get it just right. *|
|* *|
|* ROBOT CONFIGURATION *|
|* NOTES: *|
|* *|
|* MOTORS & SENSORS: *|
|* [I/O Port] [Name] [Type] [Description] *|
|* Port D motorD 12V Right motor *|
|* Port E motorE 12V Left motor *|
\*---------------------------------------------------------------------------------------------------4246-*/
#include "JoystickDriver.c"
task main()
{
int threshold = 10; /* Int 'threshold' will allow us to ignore low */
int counter = 3;
float CR=0.00;
int Forward = 1;
int Forward2= 1;
int ScoopPosition = 2; //MM

add this
int FlipPosition = 2; //MM

add this
while(true) // Infinite loop:
{
getJoystickSettings(joystick);
counter = 3;
CR = counter/2;
if(abs(joystick.joy1_y1) > threshold*Forward) // If the right analog stick's Y-axis readings are either above or below the threshold:
{
motor[motorE] = joystick.joy1_y1 * Forward; // Motor D is assigned a power level equal to the right analog stick's Y-axis reading.
}
else // Else if the readings are within the threshold:
{
if(joystick.joy1_TopHat == 4) // if the topmost button on joy1's D-Pad ('TopHat') is pressed:
{
motor[motorE] = -10; // motorE is run at a power level of 50
//motor[motorD] = -10; // motorD is run at a power level of 50
}
else if(joystick.joy1_TopHat == 0)
{
motor(motorE)=20;
//motor(motorD)=20;
}
else motor[motorE] = 0; // Motor D is stopped with a power level of 0.
}
if(abs(joystick.joy1_y2) > threshold * Forward) // If the left analog stick's Y-axis readings are either above or below the threshold:
{
motor[motorD] = joystick.joy1_y2; // Motor E is assigned a power level equal to the left analog stick's Y-axis reading.
}
else // Else if the readings are within the threshold:
{
if(joystick.joy1_TopHat == 4) // if the topmost button on joy1's D-Pad ('TopHat') is pressed:
{
//motor[motorE] = -10; // motorE is run at a power level of 50
motor[motorD] = -10; // motorD is run at a power level of 50
}
else if(joystick.joy1_TopHat == 0)
{
//motor(motorE)=20;
motor(motorD)=20;
}
else motor[motorD] = 0; // Motor E is stopped with a power level of 0.
}
if(abs(joystick.joy1_y2) > threshold*Forward2) // If the right analog stick's Y-axis readings are either above or below the threshold:
{ motor[motorF] = joystick.joy2_y2; // Motor E is assigned a power level equal to the left analog stick's Y-axis reading.
}
else // Else if the readings are within the threshold:
{
motor[motorF]= 0; // Motor E is stopped with a power level of 0.
}
if(abs(joystick.joy1_y1) > threshold * Forward2) // If the left analog stick's Y-axis readings are either above or below the threshold:
{
motor[motorG] = joystick.joy2_y1; // Motor E is assigned a power level equal to the left analog stick's Y-axis reading.
}
else // Else if the readings are within the threshold:
{
motor[motorG]= 0; // Motor E is stopped with a power level of 0.
}
nPidUpdateInterval = 20; // a good interval is 20
if(joy1Btn(5))
motor(motorI)=100;
if(joy1Btn(6))
motor(motorI)=-100;
if(joy1Btn(2))
motor(motorH)=-100;
if(joy1Btn(4))
motor(motorH)=100;
}
}