How do you change the cartridge on the motor cause I am build a scoop like a spatula?
and
how would I change my code to do it if it has two motors and I need to make it move so both motor move the same time and the motor move very slow but still making it have the same hold load on it.
Code:
#include “vex.h”
using namespace vex;
int main() {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
// Define motors
motor motor3 = motor(PORT3, ratio18_1, true);
motor motor8 = motor(PORT8, ratio18_1, false);
// Define drivetrain
drivetrain drive = drivetrain(PORT1, PORT2, 319.19, 295, 170, mm, 1);
// Define controller
controller Controller1 = controller();
// Set the motor velocity (adjust as needed)
int maxSpeed = 50; // Maximum speed for the drivetrain
int slowSpeed = 10; // Speed for motors 3 and 8
while (true) {
// Get joystick values
int verticalLeft = Controller1.Axis3.position(); // Get vertical position of the left joystick
int verticalRight = Controller1.Axis2.position(); // Get vertical position of the right joystick
// Calculate the adjusted speed based on joystick position for the drivetrain
int adjustedSpeed = (maxSpeed * verticalLeft) / 127;
// Drive the drivetrain with adjusted speed
drive.driveFor(adjustedSpeed, percent);
// Control motors 3 and 8 with the right joystick for up and down movement
if (verticalRight > 10) {
motor3.spin(forward, slowSpeed, velocityUnits::pct);
motor8.spin(forward, slowSpeed, velocityUnits::pct);
} else if (verticalRight < -10) {
motor3.spin(reverse, slowSpeed, velocityUnits::pct);
motor8.spin(reverse, slowSpeed, velocityUnits::pct);
} else {
motor3.stop();
motor8.stop();
}
wait(20, msec); // Allow other tasks to run
}
}