Usually when you download a program to your robot, the robot needs to be “refreshed” in order for the robot to run the program again. With this, there is two ways to do it. After a download, before disconnecting the USB wire from the robot, go to the robot’s file management, select that file that’s downloaded on the robot, then click “Run”. Another way is just to restart the robot after you disconnect the USB wire and it should be fixed. Hopefully this helps
I just read the question and am wondering if the poster has ever been able to control the robot with the joystick or he has been able to use the joystick and this is just starting to happen.
If the joystick has never been successfully used, it could be as simple as a programming problem, loose connector, bad joystick (probably unlikely, but possible). If the OP sees this, perhaps he can post his code.
Could the OP of the question post their code? Maybe they just don’t have a competition template.
#pragma config(Sensor, dgtl1, leftEncoder, sensorQuadEncoder)
#pragma config(Sensor, dgtl3, rightEncoder, sensorQuadEncoder)
#pragma config(Motor, port2, leftMotor, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port10, rightMotor, tmotorVex393_HBridge, openLoop, reversed)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//
task main()
{
/Reset encoders to 0/
SensorValue [leftEncoder]=0;
SensorValue [rightEncoder]=0;
while (SensorValue [rightEncoder]<200)
{
motor[leftMotor]=50;
motor[rightMotor]=50;
}
}
Thanks!
@451stroker That’s likely your issue. You’re not using the competition includes or tasks. In RobotC, go to File > New > Competition Template. This will create a file for you with the correct tasks and includes, including detailed comments on where you need to put things. In your userControl task you want to put your driving/controlled period code, and autonomous code in the autonomous task.
Yes, your code above would be placed in the autonomous task area. One more bit of code will be needed at the end of your while loop. Since your program is not ending, you need to turn the motors off.
motor[leftMotor]=0;
motor[rightMotor]=0;
Then in the user control task area of the template you would have the motors set to run against what the joystick values sent in.
while(true)
{
motor[leftMotor] = VexRT[Ch3];
motor[rightMotor] = VexRT[Ch2];
wait1MSec(20);
}
for instance…
Oh oops I should’ve asked for the code because I just went to a conclusion that he wasn’t restarting the robot. I completely forgot about asking that question . The majority of times it’s code rather than the robot so I should’ve asked for the code before going to a conclusion…
Thanks so much everyone! I’ll try the Competition Template later today and report back.