I’m designing a robot arm (which you wear) using Vex 2.0 Cortex and Natural Language PLTW.
I made a code that when started it works fine, but as time goes on the motor gets “weaker” and wont respond when pressing the limit switch. I programmed the bot to open and close when pressing or releasing the limit switch.
If anyone would like to also, how can I make it so that the light switch also works alongside the claw?
Also whenever I make the robot “autonomous” the flashlight gets super weak, I don’t know why, any help? Thanks.
Code:
----------------------------------------------------------------
#pragma config(Sensor, in2, light, sensorAnalog)
#pragma config(Sensor, dgtl1, limitSwitch, sensorTouch)
#pragma config(Motor, port1, flashlight, tmotorVexFlashlight, openLoop, reversed)
#pragma config(Motor, port3, clawMotor, tmotorVex393_MC29, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main()
{
while (1==1){
untilTouch(limitSwitch);
{
motor[clawMotor] = 127;
}
untilRelease(limitSwitch);
{
motor[clawMotor] = -127;
}
}
while(1==1){
if(SensorValue(light) >=400)
{
turnFlashlightOn(flashlight, 127);
}
else if(SensorValue(light) <400)
{
turnFlashlightOff(flashlight);
}
}
}
type or paste code here