I’m trying to make a PID controller for a robot arm. I want to know if there is a way to limit the maximum and minimum speed or power for the motor.
#pragma config(Sensor, dgtl11, ArmEncoder, sensorQuadEncoder)
#pragma config(Motor, port5, arm1, tmotorVex393_MC29, PIDControl, encoderPort, dgtl11)
#pragma config(Motor, port7, arm2, tmotorVex393_MC29)
#pragma config(MotorPidSetting, port5, 50, 25, 640, 10, 0, 80, 5, 0)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//
#pragma platform(VEX2) //This is to tell the compiler that you are using the cortex
#pragma competitionControl(Competition) //This tells the compiler that your robot will have to listen to the field for when it can go
#include “Vex_Competition_Includes.c” //This is telling it how the field will talk to it
//This is a function used to set up tasks before the match
void pre_auton(){}
//This is a function used for an autonomous mode, OCCRA does not have autonomous modes so ignore this function
task autonomous(){}
task usercontrol(){
slaveMotor(arm2, arm1);
setMotorTarget(arm1, 40, 127, true);
}
Summary
This text will be hidden