Move title comments below config to work w robotc
This commit is contained in:
parent
6587d5a8ea
commit
904c3f1f7c
48
Labs.c
48
Labs.c
@ -1,12 +1,3 @@
|
|||||||
/* Progressive Development Code
|
|
||||||
* for ETC 244 VeX Robotics Lab
|
|
||||||
* Instructor: Bill Dolan
|
|
||||||
* Fall 2023-2024
|
|
||||||
*
|
|
||||||
* Developed by Skylar Grant
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Configuration created by ROBOTC
|
|
||||||
#pragma config(Sensor, in3, armPos, sensorPotentiometer)
|
#pragma config(Sensor, in3, armPos, sensorPotentiometer)
|
||||||
#pragma config(Sensor, in4, lightRight, sensorReflection)
|
#pragma config(Sensor, in4, lightRight, sensorReflection)
|
||||||
#pragma config(Sensor, in5, lightLeft, sensorReflection)
|
#pragma config(Sensor, in5, lightLeft, sensorReflection)
|
||||||
@ -24,7 +15,19 @@
|
|||||||
#pragma config(Motor, port3, clawMotor, tmotorVex393HighSpeed_MC29, openLoop)
|
#pragma config(Motor, port3, clawMotor, tmotorVex393HighSpeed_MC29, openLoop)
|
||||||
#pragma config(Motor, port4, armMotor, tmotorVex393_MC29, openLoop)
|
#pragma config(Motor, port4, armMotor, tmotorVex393_MC29, openLoop)
|
||||||
#pragma config(Motor, port10, leftMotor, tmotorVex393_HBridge, openLoop, reversed, driveLeft, encoderPort, dgtl1)
|
#pragma config(Motor, port10, leftMotor, tmotorVex393_HBridge, openLoop, reversed, driveLeft, encoderPort, dgtl1)
|
||||||
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
|
//^^!!Code automatically generated by 'ROBOTC' configuration wizard!!^^//
|
||||||
|
|
||||||
|
//=====================================================================//
|
||||||
|
|
||||||
|
/* Progressive Development Code
|
||||||
|
* for ETC 244 VeX Robotics Lab
|
||||||
|
* Instructor: Bill Dolan
|
||||||
|
* Fall 2023-2024
|
||||||
|
*
|
||||||
|
* Developed by Skylar Grant
|
||||||
|
*/
|
||||||
|
|
||||||
|
//=====================================================================//
|
||||||
|
|
||||||
/* Quick function to set the speed of the drive motors
|
/* Quick function to set the speed of the drive motors
|
||||||
*
|
*
|
||||||
@ -41,6 +44,8 @@ void setMotors(int leftSpeed, int rightSpeed) {
|
|||||||
motor[rightMotor] = rightSpeed;
|
motor[rightMotor] = rightSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=====================================================================//
|
||||||
|
|
||||||
/* Quick function to stop both drive motors
|
/* Quick function to stop both drive motors
|
||||||
*
|
*
|
||||||
* Arguments: None
|
* Arguments: None
|
||||||
@ -52,6 +57,8 @@ void stop() {
|
|||||||
motor[rightMotor] = 0;
|
motor[rightMotor] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=====================================================================//
|
||||||
|
|
||||||
/* Function to drive the bot forward for some time
|
/* Function to drive the bot forward for some time
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -69,6 +76,8 @@ void driveForward(int speed, int timeMs) {
|
|||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=====================================================================//
|
||||||
|
|
||||||
/* Function to drive the bot backwards for some time
|
/* Function to drive the bot backwards for some time
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -88,6 +97,7 @@ void driveBackward(int speed, int timeMs) {
|
|||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=====================================================================//
|
||||||
|
|
||||||
// TODO: Just combine this into one drive function with L/R/B and a reverse boolean
|
// TODO: Just combine this into one drive function with L/R/B and a reverse boolean
|
||||||
/* Function to drive only one side's drive motors for a given time
|
/* Function to drive only one side's drive motors for a given time
|
||||||
@ -113,6 +123,8 @@ void driveOneSide(char *side, int speed, int timeMs) {
|
|||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=====================================================================//
|
||||||
|
|
||||||
// TODO: Flesh out this function
|
// TODO: Flesh out this function
|
||||||
//void drive(char *side, int speed, int timeMs, int reverse)
|
//void drive(char *side, int speed, int timeMs, int reverse)
|
||||||
|
|
||||||
@ -157,8 +169,10 @@ void turn(char *direction, int speed, int timeMs, bool reverse) {
|
|||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=====================================================================//
|
||||||
|
|
||||||
/* Move the bot's arm up or down
|
/* Move the bot's arm up or down
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* - speed: signed integer. -127 to 127
|
* - speed: signed integer. -127 to 127
|
||||||
* - <0: Down
|
* - <0: Down
|
||||||
@ -200,6 +214,8 @@ void armUp100(int speed) {
|
|||||||
motor[armMotor] = 0;
|
motor[armMotor] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=====================================================================//
|
||||||
|
|
||||||
/* Moves the robot's arm down until the limit switch is pressed
|
/* Moves the robot's arm down until the limit switch is pressed
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -223,6 +239,8 @@ void armDown100(int speed) {
|
|||||||
motor[armMotor] = 0;
|
motor[armMotor] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=====================================================================//
|
||||||
|
|
||||||
/* Close the claw
|
/* Close the claw
|
||||||
*
|
*
|
||||||
* Arguments: None
|
* Arguments: None
|
||||||
@ -238,6 +256,8 @@ void clawGrab() {
|
|||||||
motor[clawMotor] = 0;
|
motor[clawMotor] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=====================================================================//
|
||||||
|
|
||||||
/* Open the claw
|
/* Open the claw
|
||||||
*
|
*
|
||||||
* Arguments: None
|
* Arguments: None
|
||||||
@ -253,6 +273,8 @@ void clawRelease() {
|
|||||||
motor[clawMotor] = 0;
|
motor[clawMotor] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=====================================================================//
|
||||||
|
|
||||||
/* Run the autonomous code, called when the start button is pressed.
|
/* Run the autonomous code, called when the start button is pressed.
|
||||||
*
|
*
|
||||||
* Arguments: None
|
* Arguments: None
|
||||||
@ -289,6 +311,8 @@ void runAutonomous() {
|
|||||||
armDown100(16);
|
armDown100(16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=====================================================================//
|
||||||
|
|
||||||
/* Wait for the start button to be pressed, then run autonomous code.
|
/* Wait for the start button to be pressed, then run autonomous code.
|
||||||
*
|
*
|
||||||
* Arguments: None
|
* Arguments: None
|
||||||
@ -303,6 +327,8 @@ void waitForStart() {
|
|||||||
waitForStart();
|
waitForStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=====================================================================//
|
||||||
|
|
||||||
// This function gets called automatically once the bot is booted.
|
// This function gets called automatically once the bot is booted.
|
||||||
task main() {
|
task main() {
|
||||||
waitForStart();
|
waitForStart();
|
||||||
|
Loading…
Reference in New Issue
Block a user