I’m a little new to RobotC coding and I’ve tried to make a code that allows me move forward all four of my wheels by pushing the joystick, but when I upload it to the robot and push on the joystick nothing happens. I paired the controller with the robot with Vexnet Keys but it still won’t work. All of my batteries are charged and connected. Does anyone know what I’m doing wrong?
Make a repeat forever block and then put those blocks in it. Currently it only is running your code for a split second. (top fast to even turn the motors on)
It worked, sort of, but it only controlled one of the four wheels. Maybe the problem is in the wiring. I put the four pins in motor ports 1, 2, 3, and 4. Should I not be putting them there?
Do you have motor controllers between the Cortex and the motors that are attached to ports 2, 3 and 4?
My guess is the only motor that worked was the one plugged into port 1 which does not require an external motor controller.
I tried this time with a motor controller connected to the 3 ports, but this time number 4 and 1 worked. Number three and two still don’t work. I’ve tried switching the motors to different spots to see if the motors are broken, but all of them only seemed to work in spots 1 and 4.
That would mean you either have a faulty cortex or are plugging them in incorrectly. Try a new cortex and then if that doesn’t work send pictures of what you have for us to see.
Uhhh graphical, try this code here(it isnt graphical) copy and paste the ENTIRE thing into a c file(dont paste it into graphical) then follow the instructions in green. Any feedback would be helpful on how this code went
Does someone know how to upload a c file or send it to someone on here?
#pragma config(Motor, port1, Frontleft, tmotorVex393_HBridge, openLoop, driveLeft)
#pragma config(Motor, port2, Backleft, tmotorVex393_MC29, openLoop, driveLeft)
#pragma config(Motor, port3, Frontright, tmotorVex393_MC29, openLoop, reversed, driveRight)
#pragma config(Motor, port4, Backright, tmotorVex393_MC29, openLoop, reversed, driveRight)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//
//
//Enter your front left motor into port 1
//Enter your back left motor into port 2
//Enter your front right motor into port 3
//Enter your back right motor into port 4
//
//Press F5 when your PC is connect to the powered cortex
//Enjoy
//
// This code is for the VEX cortex platform
#pragma platform(VEX2)
// Select Download method as “competition”
#pragma competitionControl(Competition)
//Main competition background code…do not modify!
#include “Vex_Competition_Includes.c”
void driveTrain();
void pre_auton()
{
bStopTasksBetweenModes = true;
}
task usercontrol()
{
while (true)
{
sleep(20);
driveTrain();
}
}
void driveTrain()
{
setMotor(Frontleft, vexRT[Ch2]);//push the left joystick to control your left side
setMotor(Backleft, vexRT[Ch2]);
setMotor(Frontright, vexRT[Ch3]);//push the right joystick to control your right side
setMotor(Backright, vexRT[Ch3]);
}
task autonomous
{
//enter autonomous code here
}
Actually, M8R seems to be right. It must be that the ports are broken, because when I switched the plugs to ports 10 and 9 they seemed to work.