Can you access the sourcecode of vexcode functions?

Hi I’m currently away from the robot and I would like to know if it’s possible to access the source code of vex functions. For example, seeing what code executes when motor.spin or brain.screen.draw is called.

1 Like

I believe right clicking “spin” in your code and then clicking “go to definition” Would do that possibly

I believe that sends you to what the code does. I’m not looking for that, I’m looking for the low level code (the code that converts the percent to voltage and sends voltage to the motors, or the graphics that vex uses to do things) that runs.

To quote the GDC, “No”

To provide more information: VexCode is closed-source for a variety of reasons. While something like PROS is open source, even they need to sign NDAs and avoid disclosing the underlying API.


You could build a library following along jpearman’s work such as:

If you wanted “more control” over, in this case, the UI on the Brain.

I’ve provided a library with functionality mostly equivalent to what the open-source WPI library provides for FRC teams:


Alright thanks. I was already considering switching to PROS, this is bringing me closer.

No idea what you want to do, but I’m not sure “seeing” something like:

Will advance you very far. You can’t, in fact, make changes to it and compile it locally w/o being a member of that organization.


int32_t motor_move(uint8_t port, int32_t voltage) {
	if (voltage > 127) {
		voltage = 127;
	} else if (voltage < -127) {
		voltage = -127;

	// Remap the input voltage range to the motor voltage
	// scale to [-127, 127] -> [-12000, 12000]
	int32_t command = (((voltage + MOTOR_MOVE_RANGE) * (MOTOR_VOLTAGE_RANGE)) / (MOTOR_MOVE_RANGE));
	return motor_move_voltage(port, command);

int32_t motor_move_absolute(uint8_t port, const double position, const int32_t velocity) {
	claim_port_i(port - 1, E_DEVICE_MOTOR);
	vexDeviceMotorAbsoluteTargetSet(device->device_info, position, velocity);
	return_port(port - 1, 1);

int32_t motor_move_relative(uint8_t port, const double position, const int32_t velocity) {
	claim_port_i(port - 1, E_DEVICE_MOTOR);
	vexDeviceMotorRelativeTargetSet(device->device_info, position, velocity);
	return_port(port - 1, 1);

int32_t motor_move_velocity(uint8_t port, const int32_t velocity) {
	claim_port_i(port - 1, E_DEVICE_MOTOR);
	vexDeviceMotorVelocitySet(device->device_info, velocity);
	return_port(port - 1, 1);

Does, what, exactly, for you?


If not the ability to add functions to Motor and Brain classes, then it lets me understand the core principles of what’s going on. Im not just trying to get good at vex im Trying to get good at c++. If I can’t do any tinkering though… that sucks. Oh well, time to move on with my life

If you want to add new functions then make a subclass, for example

class motor_x : public vex::motor {
      motor_x( uint32_t index ) : motor(index) {}
      ~motor_x() {};

      void goFast( directionType dir ) {
          spin( dir, 600, rpm );

motor_x       m1(PORT1);

int main() {

    while(1) {
        // Allow other tasks to run

WHOA I like this jpearman. My graphics API can then use normal vex functions now! Thank you

For a graphics class, you can subclass just the lcd class of the brain, no need to access other things like SD card and timer, for example, here is a snippet (with some of the internal code folded up) from an internal program we have that implements some additional UI like functionality on the screen. The ui class is a subclass of vex::brain::lcd

an instance of that class, lets say it’s called “ui” can access normal drawing functions.

ui.setFont( mono15 );

as well as additional functions we add.

ui.drawRoundRectangle( t.xpos, t.ypos, t.width, t.height, 4, cola );

look up C++ inheritance, you will find lots of examples.