So guys, I had the program done before the robot was done. I had to wait before I could actually test it out, so here I am, a week until our competition and our program doesn't work. So, can anyone figure out what is wrong with the program?
Thanks,
Eric A. 'Lectric Legends-Team-8417
#pragma config(Hubs, S1, HTMotor, HTMotor, none, none)
#pragma config(Sensor, S1, , sensorI2CMuxController)
#pragma config(Motor, mtr_S1_C1_1, motorRight, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C1_2, motorLeft, tmotorTetrix, openLoop, reversed)
#pragma config(Motor, mtr_S1_C2_1, motorScissor, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C2_2, motorConveyor, tmotorTetrix, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "joystickdriver.c"
#define button1 0x01
#define button2 0x02
#define button3 0x04
#define button4 0x08
#define button5 0x10
#define button6 0x20
#define button7 0x40
#define button8 0x80
#define button9 0x100
#define button10 0x200
/*
Program Name: 'LectricLegendsDriverControl_V2
Coder's Name: Eric Adams
Team Name: 'Lectric Legends
Team Number: 8417
Drive Motors = D, E
Conveyor Belt Motor = F
Scissor Lift = G
Beater Bar = A
Left Wheel = Left Joystick(joystick1) Y value .D motor Status: Completed
Right Wheel = Right Joystick(joystick2) Y value .E Motor Status: Completed
Conveyor Belt = Buttons 6, 8. 6 = up, down. 8 = stop Status: Completed
Scissor Lift = TopHat 0,2,4,6. respectively +60cm, +30cm, -60cm,-30cm Status: Mostly Completed, Need Time Measurements For CM heights
BeaterBar = RightTrigger(Button7) toggle button Status: Completed
Emergency Stop = B Button(button3) Status: Completed
25% Power = Y Button(button4) Status: Completed
50% Power = X Button(button1) Status: Completed
100% power = A Button(button2) Status: Completed
*/
int conveyor = 0;
int scissorLift = 0;
int buttonSpeed = 50;
int maxPower = .5;
bool beaterBar = false;
task main()
{
initializeRobot();
waitForStart();
while (true)
{
getJoystickSettings(joystick);
// Turbo Mode
if (joy1Btn(4)){
buttonSpeed == 25;
maxPower == .25;
}
if (joy1Btn(1)){
buttonSpeed == 50;
maxPower == .5;
}
if (joy1Btn(2)){
buttonSpeed == 100;
maxPower == 1;
}
// End Turbo Mode
//Joystick Function
motor[MotorRight] = joy1_y1;
if(joy1_y1 > buttonSpeed) {
joy1_y1 = (joy1_y1*maxPower);
}
motor[MotorLeft] = joy1_y2;
if(joy1_y2 > buttonSpeed) {
joy1_y2 = (joy1_y2*maxPower);
}
// End Joystick Function
// Begin Conveyor belt function
if((joy1Btn(6)) && (conveyor = 0))){
conveyor = 1;
}
if((joy1Btn(6)) && (conveyor = 1)){
conveyor = 0;
}
if(joy1Btn(5)){
conveyor = -1;
}
motor[MotorConveyor] = (43.257 * conveyor);//43.257 was brandons Idea, not my fault if it breaks it.
// End conveyor belt function
// Begin Emergency Stop
if(joy1Btn(3){
motor[motorA] = 0;
motor[motorRight] = 0;
motor[motorLeft] = 0;
motor[motorConveyor] = 0;
motor[motorScissor] = 0;
}
// End Emergency Stop
// Begin Scissor Lift
if(joystick.joy1_TopHat == 0){
motor[motorScissor] = 75;
time1(200); //THIS LINE NEEDS TO BE ALTERED SO THE TIME IS RIGHT FOR +60 CM
}
if(joystick.joy1_TopHat == 2){
motor[motorScissor] = 75;
time1(200); //THIS LINE NEEDS TO BE ALTERED SO THE TIME IS RIGHT FOR +30 CM
}
if(joystick.joy1_TopHat == 4){
motor[motorScissor] = -75;
time1(200); //THIS LINE NEEDS TO BE ALTERED SO THE TIME IS RIGHT FOR -60 CM
}
if(joystick.joy1_TopHat == 6){
motor[motorScissor] = -75;
time1(200); //THIS LINE NEEDS TO BE ALTERED SO THE TIME IS RIGHT FOR -30 CM
}
// End Scissor Lift
// Begin Beater Bar Function
/* if(joy1Btn(7)) && (beaterBar = false){
beaterBar = true;
}
if(joy1Btn(7)) && (beaterBar = true){
beaterBar = false;
}
if(beaterBar = true){
motor[motorA] = 100;
}
if(beaterBar = false){
motor[motorA] = 0;
}
*/
// End Beater Bar Function Beater Bar Function Currently not in use.
}
}
Thanks,
Eric A. 'Lectric Legends-Team-8417
#pragma config(Hubs, S1, HTMotor, HTMotor, none, none)
#pragma config(Sensor, S1, , sensorI2CMuxController)
#pragma config(Motor, mtr_S1_C1_1, motorRight, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C1_2, motorLeft, tmotorTetrix, openLoop, reversed)
#pragma config(Motor, mtr_S1_C2_1, motorScissor, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C2_2, motorConveyor, tmotorTetrix, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "joystickdriver.c"
#define button1 0x01
#define button2 0x02
#define button3 0x04
#define button4 0x08
#define button5 0x10
#define button6 0x20
#define button7 0x40
#define button8 0x80
#define button9 0x100
#define button10 0x200
/*
Program Name: 'LectricLegendsDriverControl_V2
Coder's Name: Eric Adams
Team Name: 'Lectric Legends
Team Number: 8417
Drive Motors = D, E
Conveyor Belt Motor = F
Scissor Lift = G
Beater Bar = A
Left Wheel = Left Joystick(joystick1) Y value .D motor Status: Completed
Right Wheel = Right Joystick(joystick2) Y value .E Motor Status: Completed
Conveyor Belt = Buttons 6, 8. 6 = up, down. 8 = stop Status: Completed
Scissor Lift = TopHat 0,2,4,6. respectively +60cm, +30cm, -60cm,-30cm Status: Mostly Completed, Need Time Measurements For CM heights
BeaterBar = RightTrigger(Button7) toggle button Status: Completed
Emergency Stop = B Button(button3) Status: Completed
25% Power = Y Button(button4) Status: Completed
50% Power = X Button(button1) Status: Completed
100% power = A Button(button2) Status: Completed
*/
int conveyor = 0;
int scissorLift = 0;
int buttonSpeed = 50;
int maxPower = .5;
bool beaterBar = false;
task main()
{
initializeRobot();
waitForStart();
while (true)
{
getJoystickSettings(joystick);
// Turbo Mode
if (joy1Btn(4)){
buttonSpeed == 25;
maxPower == .25;
}
if (joy1Btn(1)){
buttonSpeed == 50;
maxPower == .5;
}
if (joy1Btn(2)){
buttonSpeed == 100;
maxPower == 1;
}
// End Turbo Mode
//Joystick Function
motor[MotorRight] = joy1_y1;
if(joy1_y1 > buttonSpeed) {
joy1_y1 = (joy1_y1*maxPower);
}
motor[MotorLeft] = joy1_y2;
if(joy1_y2 > buttonSpeed) {
joy1_y2 = (joy1_y2*maxPower);
}
// End Joystick Function
// Begin Conveyor belt function
if((joy1Btn(6)) && (conveyor = 0))){
conveyor = 1;
}
if((joy1Btn(6)) && (conveyor = 1)){
conveyor = 0;
}
if(joy1Btn(5)){
conveyor = -1;
}
motor[MotorConveyor] = (43.257 * conveyor);//43.257 was brandons Idea, not my fault if it breaks it.
// End conveyor belt function
// Begin Emergency Stop
if(joy1Btn(3){
motor[motorA] = 0;
motor[motorRight] = 0;
motor[motorLeft] = 0;
motor[motorConveyor] = 0;
motor[motorScissor] = 0;
}
// End Emergency Stop
// Begin Scissor Lift
if(joystick.joy1_TopHat == 0){
motor[motorScissor] = 75;
time1(200); //THIS LINE NEEDS TO BE ALTERED SO THE TIME IS RIGHT FOR +60 CM
}
if(joystick.joy1_TopHat == 2){
motor[motorScissor] = 75;
time1(200); //THIS LINE NEEDS TO BE ALTERED SO THE TIME IS RIGHT FOR +30 CM
}
if(joystick.joy1_TopHat == 4){
motor[motorScissor] = -75;
time1(200); //THIS LINE NEEDS TO BE ALTERED SO THE TIME IS RIGHT FOR -60 CM
}
if(joystick.joy1_TopHat == 6){
motor[motorScissor] = -75;
time1(200); //THIS LINE NEEDS TO BE ALTERED SO THE TIME IS RIGHT FOR -30 CM
}
// End Scissor Lift
// Begin Beater Bar Function
/* if(joy1Btn(7)) && (beaterBar = false){
beaterBar = true;
}
if(joy1Btn(7)) && (beaterBar = true){
beaterBar = false;
}
if(beaterBar = true){
motor[motorA] = 100;
}
if(beaterBar = false){
motor[motorA] = 0;
}
*/
// End Beater Bar Function Beater Bar Function Currently not in use.
}
}
Comment