pros::c namespace

Functions

adi_port_config_e_t pros::c::adi_port_get_config(uint8_t port)
Gets the configuration for the given ADI port.
int32_t pros::c::adi_port_get_value(uint8_t port)
Gets the value for the given ADI port.
int32_t pros::c::adi_port_set_config(uint8_t port, adi_port_config_e_t type)
Configures an ADI port to act as a given sensor type.
int32_t pros::c::adi_port_set_value(uint8_t port, int32_t value)
Sets the value for the given ADI port.
int32_t pros::c::adi_analog_calibrate(uint8_t port)
Calibrates the analog sensor on the specified port and returns the new calibration value.
int32_t pros::c::adi_analog_read(uint8_t port)
Gets the 12-bit value of the specified port.
int32_t pros::c::adi_analog_read_calibrated(uint8_t port)
Gets the 12 bit calibrated value of an analog input port.
int32_t pros::c::adi_analog_read_calibrated_HR(uint8_t port)
Gets the 16 bit calibrated value of an analog input port.
int32_t pros::c::adi_digital_read(uint8_t port)
Gets the digital value (1 or 0) of a port configured as a digital input.
int32_t pros::c::adi_digital_get_new_press(uint8_t port)
Gets a rising-edge case for a digital button press.
int32_t pros::c::adi_digital_write(uint8_t port, bool value)
Sets the digital value (1 or 0) of a port configured as a digital output.
int32_t pros::c::adi_pin_mode(uint8_t port, uint8_t mode)
Configures the port as an input or output with a variety of settings.
int32_t pros::c::adi_motor_set(uint8_t port, int8_t speed)
Sets the speed of the motor on the given port.
int32_t pros::c::adi_motor_get(uint8_t port)
Gets the last set speed of the motor on the given port.
int32_t pros::c::adi_motor_stop(uint8_t port)
Stops the motor on the given port.
int32_t pros::c::adi_encoder_get(adi_encoder_t enc)
Gets the number of ticks recorded by the encoder.
adi_encoder_t pros::c::adi_encoder_init(uint8_t port_top, uint8_t port_bottom, bool reverse)
Creates an encoder object and configures the specified ports accordingly.
int32_t pros::c::adi_encoder_reset(adi_encoder_t enc)
Sets the encoder value to zero.
int32_t pros::c::adi_encoder_shutdown(adi_encoder_t enc)
Disables the encoder and voids the configuration on its ports.
int32_t pros::c::adi_ultrasonic_get(adi_ultrasonic_t ult)
Gets the current ultrasonic sensor value in centimeters.
adi_ultrasonic_t pros::c::adi_ultrasonic_init(uint8_t port_ping, uint8_t port_echo)
Creates an ultrasonic object and configures the specified ports accordingly.
int32_t pros::c::adi_ultrasonic_shutdown(adi_ultrasonic_t ult)
Disables the ultrasonic sensor and voids the configuration on its ports.
double pros::c::adi_gyro_get(adi_gyro_t gyro)
Gets the current gyro angle in tenths of a degree.
adi_gyro_t pros::c::adi_gyro_init(uint8_t port, double multiplier)
Initializes a gyroscope on the given port.
int32_t pros::c::adi_gyro_reset(adi_gyro_t gyro)
Resets the gyroscope value to zero.
int32_t pros::c::adi_gyro_shutdown(adi_gyro_t gyro)
Disables the gyro and voids the configuration on its port.
adi_potentiometer_t pros::c::adi_potentiometer_init(uint8_t port)
Initializes a potentiometer on the given port of the original potentiometer.
adi_potentiometer_t pros::c::adi_potentiometer_type_init(uint8_t port, adi_potentiometer_type_e_t potentiometer_type)
Initializes a potentiometer on the given port.
double pros::c::adi_potentiometer_get_angle(adi_potentiometer_t potentiometer)
Gets the current potentiometer angle in tenths of a degree.
adi_led_t pros::c::adi_led_init(uint8_t port)
Initializes a led on the given port of the original led.
int32_t pros::c::adi_led_clear_all(adi_led_t led, uint32_t* buffer, uint32_t buffer_length)
Clear the entire led strip of color.
int32_t pros::c::adi_led_set(adi_led_t led, uint32_t* buffer, uint32_t buffer_length)
Set the entire led strip using the colors contained in the buffer.
int32_t pros::c::adi_led_set_all(adi_led_t led, uint32_t* buffer, uint32_t buffer_length, uint32_t color)
Set the entire led strip to one color.
int32_t pros::c::adi_led_set_pixel(adi_led_t led, uint32_t* buffer, uint32_t buffer_length, uint32_t color, uint32_t pixel_position)
Set one pixel on the led strip.
int32_t pros::c::adi_led_clear_pixel(adi_led_t led, uint32_t* buffer, uint32_t buffer_length, uint32_t pixel_position)
Clear one pixel on the led strip.
v5_device_e_t pros::c::get_plugged_type(uint8_t port)
Gets the type of device on given port.
int32_t pros::c::distance_get(uint8_t port)
Get the currently measured distance from the sensor in mm.
int32_t pros::c::distance_get_confidence(uint8_t port)
Get the confidence in the distance reading.
int32_t pros::c::distance_get_object_size(uint8_t port)
Get the current guess at relative object size.
double pros::c::distance_get_object_velocity(uint8_t port)
Get the object velocity in m/s.
adi_port_config_e_t pros::c::ext_adi_port_get_config(uint8_t smart_port, uint8_t adi_port)
General ADI Use Functions
int32_t pros::c::ext_adi_port_get_value(uint8_t smart_port, uint8_t adi_port)
Gets the value for the given ADI port.
int32_t pros::c::ext_adi_port_set_config(uint8_t smart_port, uint8_t adi_port, adi_port_config_e_t type)
Configures an ADI port to act as a given sensor type.
int32_t pros::c::ext_adi_port_set_value(uint8_t smart_port, uint8_t adi_port, int32_t value)
Sets the value for the given ADI port.
int32_t pros::c::ext_adi_analog_calibrate(uint8_t smart_port, uint8_t adi_port)
Calibrates the analog sensor on the specified port and returns the new calibration value.
int32_t pros::c::ext_adi_analog_read(uint8_t smart_port, uint8_t adi_port)
Gets the 12-bit value of the specified port.
int32_t pros::c::ext_adi_analog_read_calibrated(uint8_t smart_port, uint8_t adi_port)
Gets the 12 bit calibrated value of an analog input port.
int32_t pros::c::ext_adi_analog_read_calibrated_HR(uint8_t smart_port, uint8_t adi_port)
Gets the 16 bit calibrated value of an analog input port.
int32_t pros::c::ext_adi_digital_read(uint8_t smart_port, uint8_t adi_port)
Gets the digital value (1 or 0) of a port configured as a digital input.
int32_t pros::c::ext_adi_digital_get_new_press(uint8_t smart_port, uint8_t adi_port)
Gets a rising-edge case for a digital button press.
int32_t pros::c::ext_adi_digital_write(uint8_t smart_port, uint8_t adi_port, bool value)
Sets the digital value (1 or 0) of a port configured as a digital output.
int32_t pros::c::ext_adi_pin_mode(uint8_t smart_port, uint8_t adi_port, uint8_t mode)
Configures the port as an input or output with a variety of settings.
int32_t pros::c::ext_adi_motor_set(uint8_t smart_port, uint8_t adi_port, int8_t speed)
Sets the speed of the motor on the given port.
int32_t pros::c::ext_adi_motor_get(uint8_t smart_port, uint8_t adi_port)
Gets the last set speed of the motor on the given port.
int32_t pros::c::ext_adi_motor_stop(uint8_t smart_port, uint8_t adi_port)
Stops the motor on the given port.
int32_t pros::c::ext_adi_encoder_get(ext_adi_encoder_t enc)
Gets the number of ticks recorded by the encoder.
ext_adi_encoder_t pros::c::ext_adi_encoder_init(uint8_t smart_port, uint8_t adi_port_top, uint8_t adi_port_bottom, bool reverse)
Creates an encoder object and configures the specified ports accordingly.
int32_t pros::c::ext_adi_encoder_reset(ext_adi_encoder_t enc)
Sets the encoder value to zero.
int32_t pros::c::ext_adi_encoder_shutdown(ext_adi_encoder_t enc)
Disables the encoder and voids the configuration on its ports.
int32_t pros::c::ext_adi_ultrasonic_get(ext_adi_ultrasonic_t ult)
Gets the current ultrasonic sensor value in centimeters.
ext_adi_ultrasonic_t pros::c::ext_adi_ultrasonic_init(uint8_t smart_port, uint8_t adi_port_ping, uint8_t adi_port_echo)
Creates an ultrasonic object and configures the specified ports accordingly.
int32_t pros::c::ext_adi_ultrasonic_shutdown(ext_adi_ultrasonic_t ult)
Disables the ultrasonic sensor and voids the configuration on its ports.
double pros::c::ext_adi_gyro_get(ext_adi_gyro_t gyro)
Gets the current gyro angle in tenths of a degree.
ext_adi_gyro_t pros::c::ext_adi_gyro_init(uint8_t smart_port, uint8_t adi_port, double multiplier)
Initializes a gyroscope on the given port.
int32_t pros::c::ext_adi_gyro_reset(ext_adi_gyro_t gyro)
Resets the gyroscope value to zero.
int32_t pros::c::ext_adi_gyro_shutdown(ext_adi_gyro_t gyro)
Disables the gyro and voids the configuration on its port.
ext_adi_potentiometer_t pros::c::ext_adi_potentiometer_init(uint8_t smart_port, uint8_t adi_port, adi_potentiometer_type_e_t potentiometer_type)
Initializes a potentiometer on the given port.
double pros::c::ext_adi_potentiometer_get_angle(ext_adi_potentiometer_t potentiometer)
Gets the current potentiometer angle in tenths of a degree.
ext_adi_led_t pros::c::ext_adi_led_init(uint8_t smart_port, uint8_t adi_port)
Initializes a led on the given port.
int32_t pros::c::ext_adi_led_clear_all(ext_adi_led_t led, uint32_t* buffer, uint32_t buffer_length)
Clear the entire led strip of color.
int32_t pros::c::ext_adi_led_set(ext_adi_led_t led, uint32_t* buffer, uint32_t buffer_length)
Set the entire led strip using the colors contained in the buffer.
int32_t pros::c::ext_adi_led_set_all(ext_adi_led_t led, uint32_t* buffer, uint32_t buffer_length, uint32_t color)
Set the entire led strip to one color.
int32_t pros::c::ext_adi_led_set_pixel(ext_adi_led_t led, uint32_t* buffer, uint32_t buffer_length, uint32_t color, uint32_t pixel_position)
Set one pixel on the led strip.
int32_t pros::c::ext_adi_led_clear_pixel(ext_adi_led_t led, uint32_t* buffer, uint32_t buffer_length, uint32_t pixel_position)
Clear one pixel on the led strip.
int32_t pros::c::gps_initialize_full(uint8_t port, double xInitial, double yInitial, double headingInitial, double xOffset, double yOffset)
Set the GPS's offset relative to the center of turning in meters, as well as its initial position.
int32_t pros::c::gps_set_offset(uint8_t port, double xOffset, double yOffset)
Set the GPS's offset relative to the center of turning in meters.
gps_position_s_t pros::c::gps_get_offset(uint8_t port)
Get the GPS's cartesian location relative to the center of turning/origin in meters.
int32_t pros::c::gps_set_position(uint8_t port, double xInitial, double yInitial, double headingInitial)
Sets the robot's location relative to the center of the field in meters.
int32_t pros::c::gps_set_data_rate(uint8_t port, uint32_t rate)
Set the GPS sensor's data rate in milliseconds, only applies to IMU on GPS.
double pros::c::gps_get_error(uint8_t port)
Get the possible RMS (Root Mean Squared) error in meters for GPS position.
gps_status_s_t pros::c::gps_get_position_and_orientation(uint8_t port)
Gets the position and roll, yaw, and pitch of the GPS.
gps_position_s_t pros::c::gps_get_position(uint8_t port)
Gets the x and y position on the field of the GPS in meters.
double pros::c::gps_get_position_x(uint8_t port)
Gets the X position in meters of the robot relative to the starting position.
double pros::c::gps_get_position_y(uint8_t port)
Gets the Y position in meters of the robot relative to the starting position.
gps_orientation_s_t pros::c::gps_get_orientation(uint8_t port)
Gets the pitch, roll, and yaw of the GPS relative to the starting orientation.
double pros::c::gps_get_pitch(uint8_t port)
Gets the pitch of the robot in degrees relative to the starting oreintation.
double pros::c::gps_get_roll(uint8_t port)
Gets the roll of the robot in degrees relative to the starting oreintation.
double pros::c::gps_get_yaw(uint8_t port)
Gets the yaw of the robot in degrees relative to the starting oreintation.
double pros::c::gps_get_heading(uint8_t port)
Get the heading in [0,360) degree values.
double pros::c::gps_get_heading_raw(uint8_t port)
Get the heading in the max double value and min double value scale.
gps_gyro_s_t pros::c::gps_get_gyro_rate(uint8_t port)
Get the GPS's raw gyroscope values.
double pros::c::gps_get_gyro_rate_x(uint8_t port)
Get the GPS's raw gyroscope value in x-axis.
double pros::c::gps_get_gyro_rate_y(uint8_t port)
Get the GPS's raw gyroscope value in y-axis.
double pros::c::gps_get_gyro_rate_z(uint8_t port)
Get the GPS's raw gyroscope value in z-axis.
gps_accel_s_t pros::c::gps_get_accel(uint8_t port)
Get the GPS's raw accelerometer values.
double pros::c::gps_get_accel_x(uint8_t port)
Get the GPS's raw accelerometer value in x-axis.
double pros::c::gps_get_accel_y(uint8_t port)
Get the GPS's raw accelerometer value in y-axis.
double pros::c::gps_get_accel_z(uint8_t port)
Get the GPS's raw accelerometer value in z-axis.
int32_t pros::c::imu_reset(uint8_t port)
Calibrate IMU.
int32_t pros::c::imu_reset_blocking(uint8_t port)
Calibrate IMU and Blocks while Calibrating.
int32_t pros::c::imu_set_data_rate(uint8_t port, uint32_t rate)
Set the Inertial Sensor's refresh interval in milliseconds.
double pros::c::imu_get_rotation(uint8_t port)
Get the total number of degrees the Inertial Sensor has spun about the z-axis.
double pros::c::imu_get_heading(uint8_t port)
Get the Inertial Sensor's heading relative to the initial direction of its x-axis.
quaternion_s_t pros::c::imu_get_quaternion(uint8_t port)
Get a quaternion representing the Inertial Sensor's orientation.
euler_s_t pros::c::imu_get_euler(uint8_t port)
Get the Euler angles representing the Inertial Sensor's orientation.
imu_gyro_s_t pros::c::imu_get_gyro_rate(uint8_t port)
Get the Inertial Sensor's raw gyroscope values.
imu_accel_s_t pros::c::imu_get_accel(uint8_t port)
Get the Inertial Sensor's raw acceleroneter values.
imu_status_e_t pros::c::imu_get_status(uint8_t port)
Get the Inertial Sensor's status.
double pros::c::imu_get_pitch(uint8_t port)
Get the Inertial Sensor's pitch angle bounded by (-180,180)
double pros::c::imu_get_roll(uint8_t port)
Get the Inertial Sensor's roll angle bounded by (-180,180)
double pros::c::imu_get_yaw(uint8_t port)
Get the Inertial Sensor's yaw angle bounded by (-180,180)
uint32_t pros::c::link_init(uint8_t port, const char* link_id, link_type_e_t type)
Initializes a link on a radio port, with an indicated type.
uint32_t pros::c::link_init_override(uint8_t port, const char* link_id, link_type_e_t type)
Initializes a link on a radio port, with an indicated type and the ability for vexlink to override the controller radio.
bool pros::c::link_connected(uint8_t port)
Checks if a radio link on a port is active or not.
uint32_t pros::c::link_raw_receivable_size(uint8_t port)
Returns the bytes of data available to be read.
uint32_t pros::c::link_raw_transmittable_size(uint8_t port)
Returns the bytes of data available in transmission buffer.
uint32_t pros::c::link_transmit_raw(uint8_t port, void* data, uint16_t data_size)
Send raw serial data through vexlink.
uint32_t pros::c::link_receive_raw(uint8_t port, void* dest, uint16_t data_size)
Receive raw serial data through vexlink.
uint32_t pros::c::link_transmit(uint8_t port, void* data, uint16_t data_size)
Send packeted message through vexlink, with a checksum and start byte.
uint32_t pros::c::link_receive(uint8_t port, void* dest, uint16_t data_size)
Receive packeted message through vexlink, with a checksum and start byte.
uint32_t pros::c::link_clear_receive_buf(uint8_t port)
Clear the receive buffer of the link, and discarding the data.
bool pros::c::__attribute__((weak)) lcd_print(int16_t line
Displays a formatted string on the emulated three-button LCD screen.
uint8_t pros::c::competition_get_status(void)
uint8_t pros::c::competition_is_disabled(void)
uint8_t pros::c::competition_is_connected(void)
uint8_t pros::c::competition_is_autonomous(void)
uint8_t pros::c::competition_is_field(void)
int32_t pros::c::controller_is_connected(controller_id_e_t id)
int32_t pros::c::controller_get_analog(controller_id_e_t id, controller_analog_e_t channel)
Gets the value of an analog channel (joystick) on a controller.
int32_t pros::c::controller_get_battery_capacity(controller_id_e_t id)
Gets the battery capacity of the given controller.
int32_t pros::c::controller_get_battery_level(controller_id_e_t id)
Gets the battery level of the given controller.
int32_t pros::c::controller_get_digital(controller_id_e_t id, controller_digital_e_t button)
Checks if a digital channel (button) on the controller is currently pressed.
int32_t pros::c::controller_get_digital_new_press(controller_id_e_t id, controller_digital_e_t button)
Returns a rising-edge case for a controller button press.
int32_t pros::c::controller_print(controller_id_e_t id, uint8_t line, uint8_t col, const char* fmt, ...)
Sets text to the controller LCD screen.
int32_t pros::c::controller_set_text(controller_id_e_t id, uint8_t line, uint8_t col, const char* str)
Sets text to the controller LCD screen.
int32_t pros::c::controller_clear_line(controller_id_e_t id, uint8_t line)
Clears an individual line of the controller screen.
int32_t pros::c::controller_clear(controller_id_e_t id)
Clears all of the lines on the controller screen.
int32_t pros::c::controller_rumble(controller_id_e_t id, const char* rumble_pattern)
Rumble the controller.
int32_t pros::c::battery_get_voltage(void)
Gets the current voltage of the battery, as reported by VEXos.
int32_t pros::c::battery_get_current(void)
Gets the current current of the battery, as reported by VEXos.
double pros::c::battery_get_temperature(void)
Gets the current temperature of the battery, as reported by VEXos.
double pros::c::battery_get_capacity(void)
Gets the current capacity of the battery, as reported by VEXos.
int32_t pros::c::usd_is_installed(void)
Checks if the SD card is installed.
int32_t pros::c::usd_list_files(const char* path, char* buffer, int32_t len)
Lists the files in a directory specified by the path Puts the list of file names (NOT DIRECTORIES) into the buffer seperated by newlines.
uint32_t pros::c::motor_get_faults(int8_t port)
Gets the faults experienced by the motor.
uint32_t pros::c::motor_get_flags(int8_t port)
Gets the flags set by the motor's operation.
int32_t pros::c::motor_get_raw_position(int8_t port, uint32_t*const timestamp)
Gets the raw encoder count of the motor at a given timestamp.
double pros::c::motor_get_position(int8_t port)
Gets the absolute position of the motor in its encoder units.
double pros::c::motor_get_power(int8_t port)
Gets the power drawn by the motor in Watts.
double pros::c::motor_get_temperature(int8_t port)
Gets the temperature of the motor in degrees Celsius.
double pros::c::motor_get_torque(int8_t port)
Gets the torque generated by the motor in Newton Meters (Nm).
int32_t pros::c::motor_get_voltage(int8_t port)
Gets the voltage delivered to the motor in millivolts.
int32_t pros::c::motor_set_zero_position(int8_t port, const double position)
Sets the position for the motor in its encoder units.
int32_t pros::c::motor_tare_position(int8_t port)
Sets the "absolute" zero position of the motor to its current position.
int32_t pros::c::motor_set_brake_mode(int8_t port, const motor_brake_mode_e_t mode)
Sets one of motor_brake_mode_e_t to the motor.
int32_t pros::c::motor_set_current_limit(int8_t port, const int32_t limit)
Sets the current limit for the motor in mA.
int32_t pros::c::motor_set_encoder_units(int8_t port, const motor_encoder_units_e_t units)
Sets one of motor_encoder_units_e_t for the motor encoder.
int32_t pros::c::motor_set_gearing(int8_t port, const motor_gearset_e_t gearset)
Sets one of motor_gearset_e_t for the motor.
int32_t pros::c::motor_set_voltage_limit(int8_t port, const int32_t limit)
Sets the voltage limit for the motor in Volts.
motor_brake_mode_e_t pros::c::motor_get_brake_mode(int8_t port)
Gets the brake mode that was set for the motor.
int32_t pros::c::motor_get_current_limit(int8_t port)
Gets the current limit for the motor in mA.
motor_encoder_units_e_t pros::c::motor_get_encoder_units(int8_t port)
Gets the encoder units that were set for the motor.
motor_gearset_e_t pros::c::motor_get_gearing(int8_t port)
Gets the gearset that was set for the motor.
int32_t pros::c::motor_get_voltage_limit(int8_t port)
Gets the voltage limit set by the user.
int32_t pros::c::rotation_reset(uint8_t port)
Reset Rotation Sensor.
int32_t pros::c::rotation_set_data_rate(uint8_t port, uint32_t rate)
Set the Rotation Sensor's refresh interval in milliseconds.
int32_t pros::c::rotation_set_position(uint8_t port, uint32_t position)
Set the Rotation Sensor position reading to a desired rotation value.
int32_t pros::c::rotation_reset_position(uint8_t port)
Reset the Rotation Sensor position to 0.
int32_t pros::c::rotation_get_position(uint8_t port)
Get the Rotation Sensor's current position in centidegrees.
int32_t pros::c::rotation_get_velocity(uint8_t port)
Get the Rotation Sensor's current velocity in centidegrees per second.
int32_t pros::c::rotation_get_angle(uint8_t port)
Get the Rotation Sensor's current angle in centidegrees (0-36000)
int32_t pros::c::rotation_set_reversed(uint8_t port, bool value)
Set the Rotation Sensor's direction reversed flag.
int32_t pros::c::rotation_reverse(uint8_t port)
Reverse the Rotation Sensor's direction.
int32_t pros::c::rotation_init_reverse(uint8_t port, bool reverse_flag)
Initialize the Rotation Sensor with a reverse flag.
int32_t pros::c::rotation_get_reversed(uint8_t port)
Get the Rotation Sensor's reversed flag.
uint32_t pros::c::millis(void)
Gets the number of milliseconds since PROS initialized.
uint64_t pros::c::micros(void)
Gets the number of microseconds since PROS initialized,.
task_t pros::c::task_create(task_fn_t function, void*const parameters, uint32_t prio, const uint16_t stack_depth, const char*const name)
Creates a new task and add it to the list of tasks that are ready to run.
void pros::c::task_delete(task_t task)
Removes a task from the RTOS real time kernel's management.
void pros::c::task_delay(const uint32_t milliseconds)
Delays the current task for a given number of milliseconds.
void pros::c::delay(const uint32_t milliseconds)
Delays the current task for a given number of milliseconds.
void pros::c::task_delay_until(uint32_t*const prev_time, const uint32_t delta)
Delays the current task until a specified time.
uint32_t pros::c::task_get_priority(task_t task)
Gets the priority of the specified task.
void pros::c::task_set_priority(task_t task, uint32_t prio)
Sets the priority of the specified task.
task_state_e_t pros::c::task_get_state(task_t task)
Gets the state of the specified task.
void pros::c::task_suspend(task_t task)
Suspends the specified task, making it ineligible to be scheduled.
void pros::c::task_resume(task_t task)
Resumes the specified task, making it eligible to be scheduled.
uint32_t pros::c::task_get_count(void)
Gets the number of tasks the kernel is currently managing, including all ready, blocked, or suspended tasks.
char* pros::c::task_get_name(task_t task)
Gets the name of the specified task.
task_t pros::c::task_get_by_name(const char* name)
Gets a task handle from the specified name.
task_t pros::c::task_get_current()
Get the currently running task handle.
uint32_t pros::c::task_notify(task_t task)
Sends a simple notification to task and increments the notification counter.
void pros::c::task_join(task_t task)
Utilizes task notifications to wait until specified task is complete and deleted, then continues to execute the program.
uint32_t pros::c::task_notify_ext(task_t task, uint32_t value, notify_action_e_t action, uint32_t* prev_value)
Sends a notification to a task, optionally performing some action.
uint32_t pros::c::task_notify_take(bool clear_on_exit, uint32_t timeout)
Waits for a notification to be nonzero.
bool pros::c::task_notify_clear(task_t task)
Clears the notification for a task.
mutex_t pros::c::mutex_create(void)
Creates a mutex.
bool pros::c::mutex_take(mutex_t mutex, uint32_t timeout)
Takes and locks a mutex, waiting for up to a certain number of milliseconds before timing out.
bool pros::c::mutex_give(mutex_t mutex)
Unlocks a mutex.
void pros::c::mutex_delete(mutex_t mutex)
Deletes a mutex.
bool pros::c::lcd_is_initialized(void)
Checks whether the emulated three-button LCD has already been initialized.
bool pros::c::lcd_initialize(void)
Creates an emulation of the three-button, UART-based VEX LCD on the display.
bool pros::c::lcd_shutdown(void)
Turns off the Legacy LCD Emulator.
bool pros::c::lcd_print(int16_t line, const char* fmt, ...)
Displays a formatted string on the emulated three-button LCD screen.
bool pros::c::lcd_set_text(int16_t line, const char* text)
Displays a string on the emulated three-button LCD screen.
bool pros::c::lcd_clear(void)
Clears the contents of the emulated three-button LCD screen.
bool pros::c::lcd_clear_line(int16_t line)
Clears the contents of a line of the emulated three-button LCD screen.
bool pros::c::lcd_register_btn0_cb(lcd_btn_cb_fn_t cb)
Registers a callback function for the leftmost button.
bool pros::c::lcd_register_btn1_cb(lcd_btn_cb_fn_t cb)
Registers a callback function for the center button.
bool pros::c::lcd_register_btn2_cb(lcd_btn_cb_fn_t cb)
Registers a callback function for the rightmost button.
uint8_t pros::c::lcd_read_buttons(void)
Gets the button status from the emulated three-button LCD.
void pros::c::lcd_set_text_align(text_align_e_t alignment)
Changes the alignment of text on the LCD background.

RTOS Facilities

using queue_t = void*
Unblocks a task in the Blocked state (e.g.
using sem_t = void*
Unblocks a task in the Blocked state (e.g.
bool pros::c::task_abort_delay(task_t task)
Unblocks a task in the Blocked state (e.g.
void pros::c::task_notify_when_deleting(task_t target_task, task_t task_to_notify, uint32_t value, notify_action_e_t notify_action)
Notify a task when a target task is being deleted.
mutex_t pros::c::mutex_recursive_create(void)
Creates a recursive mutex which can be locked recursively by the owner.
bool pros::c::mutex_recursive_take(mutex_t mutex, uint32_t timeout)
Takes a recursive mutex.
bool pros::c::mutex_recursive_give(mutex_t mutex)
Gives a recursive mutex.
task_t pros::c::mutex_get_owner(mutex_t mutex)
Returns a handle to the current owner of a mutex.
sem_t pros::c::sem_create(uint32_t max_count, uint32_t init_count)
Creates a counting sempahore.
void pros::c::sem_delete(sem_t sem)
Deletes a semaphore (or binary semaphore)
sem_t pros::c::sem_binary_create(void)
Creates a binary semaphore.
bool pros::c::sem_wait(sem_t sem, uint32_t timeout)
Waits for the semaphore's value to be greater than 0.
bool pros::c::sem_post(sem_t sem)
Increments a semaphore's value.
uint32_t pros::c::sem_get_count(sem_t sem)
Returns the current value of the semaphore.
queue_t pros::c::queue_create(uint32_t length, uint32_t item_size)
Creates a queue.
bool pros::c::queue_append(queue_t queue, const void* item, uint32_t timeout)
Posts an item to the front of a queue.
bool pros::c::queue_peek(queue_t queue, void*const buffer, uint32_t timeout)
Receive an item from a queue without removing the item from the queue.
bool pros::c::queue_recv(queue_t queue, void*const buffer, uint32_t timeout)
Receive an item from the queue.
uint32_t pros::c::queue_get_waiting(const queue_t queue)
Return the number of messages stored in a queue.
uint32_t pros::c::queue_get_available(const queue_t queue)
Return the number of spaces left in a queue.
void pros::c::queue_delete(queue_t queue)
Delete a queue.
void pros::c::queue_reset(queue_t queue)
Resets a queue to an empty state.

Device Registration

int pros::c::registry_bind_port(uint8_t port, v5_device_e_t device_type)
Registers a device in the given zero-indexed port.
int pros::c::registry_unbind_port(uint8_t port)
Deregisters a devices from the given zero-indexed port.
v5_device_e_t pros::c::registry_get_bound_type(uint8_t port)
Returns the type of device registered to the zero-indexed port.
v5_device_e_t pros::c::registry_get_plugged_type(uint8_t port)
Returns the type of the device plugged into the zero-indexed port.

Filesystem

int32_t pros::c::fdctl(int file, const uint32_t action, void*const extra_arg)
Control settings of the serial driver.
int32_t pros::c::motor_set_reversed(int8_t port, const bool reverse)
Sets the reverse flag for the motor.
int32_t pros::c::motor_is_reversed(int8_t port)
Gets the operation direction of the motor as set by the user.

Value Reset Functions

int32_t pros::c::imu_tare_heading(uint8_t port)
Resets the current reading of the Inertial Sensor's heading to zero.
int32_t pros::c::imu_tare_rotation(uint8_t port)
Resets the current reading of the Inertial Sensor's rotation to zero.
int32_t pros::c::imu_tare_pitch(uint8_t port)
Resets the current reading of the Inertial Sensor's pitch to zero.
int32_t pros::c::imu_tare_roll(uint8_t port)
Resets the current reading of the Inertial Sensor's roll to zero.
int32_t pros::c::imu_tare_yaw(uint8_t port)
Resets the current reading of the Inertial Sensor's yaw to zero.
int32_t pros::c::imu_tare_euler(uint8_t port)
Reset all 3 euler values of the Inertial Sensor to 0.
int32_t pros::c::imu_tare(uint8_t port)
Resets all 5 values of the Inertial Sensor to 0.

Value Set Functions

int32_t pros::c::imu_set_euler(uint8_t port, euler_s_t target)
Sets the current reading of the Inertial Sensor's euler values to target euler values.
int32_t pros::c::imu_set_rotation(uint8_t port, double target)
Sets the current reading of the Inertial Sensor's rotation to target value.
int32_t pros::c::imu_set_heading(uint8_t port, double target)
Sets the current reading of the Inertial Sensor's heading to target value Target will default to 360 if above 360 and default to 0 if below 0.
int32_t pros::c::imu_set_pitch(uint8_t port, double target)
Sets the current reading of the Inertial Sensor's pitch to target value Will default to +/- 180 if target exceeds +/- 180.
int32_t pros::c::imu_set_roll(uint8_t port, double target)
Sets the current reading of the Inertial Sensor's roll to target value Will default to +/- 180 if target exceeds +/- 180.
int32_t pros::c::imu_set_yaw(uint8_t port, double target)
Sets the current reading of the Inertial Sensor's yaw to target value Will default to +/- 180 if target exceeds +/- 180.
imu_orientation_e_t pros::c::imu_get_physical_orientation(uint8_t port)
Returns the physical orientation of the IMU.

Motor movement functions

These functions allow programmers to make motors move

int32_t pros::c::motor_move(int8_t port, int32_t voltage)
Sets the voltage for the motor from -127 to 127.
int32_t pros::c::motor_brake(int8_t port)
Stops the motor using the currently configured brake mode.
int32_t pros::c::motor_move_absolute(int8_t port, double position, const int32_t velocity)
Sets the target absolute position for the motor to move to.
int32_t pros::c::motor_move_relative(int8_t port, double position, const int32_t velocity)
Sets the relative target position for the motor to move to.
int32_t pros::c::motor_move_velocity(int8_t port, const int32_t velocity)
Sets the velocity for the motor.
int32_t pros::c::motor_move_voltage(int8_t port, const int32_t voltage)
Sets the output voltage for the motor from -12000 to 12000 in millivolts.
int32_t pros::c::motor_modify_profiled_velocity(int8_t port, const int32_t velocity)
Changes the output velocity for a profiled movement (motor_move_absolute or motor_move_relative).
double pros::c::motor_get_target_position(int8_t port)
Gets the target position set for the motor by the user.
int32_t pros::c::motor_get_target_velocity(int8_t port)
Gets the velocity commanded to the motor by the user.

Motor telemetry functions

These functions allow programmers to collect telemetry from motors

double pros::c::motor_get_actual_velocity(int8_t port)
Gets the actual velocity of the motor.
int32_t pros::c::motor_get_current_draw(int8_t port)
Gets the current drawn by the motor in mA.
int32_t pros::c::motor_get_direction(int8_t port)
Gets the direction of movement for the motor.
double pros::c::motor_get_efficiency(int8_t port)
Gets the efficiency of the motor in percent.
int32_t pros::c::motor_is_over_current(int8_t port)
Checks if the motor is drawing over its current limit.
int32_t pros::c::motor_is_over_temp(int8_t port)
Checks if the motor's temperature is above its limit.

Functions

double pros::c::optical_get_hue(uint8_t port)
Get the detected color hue.
double pros::c::optical_get_saturation(uint8_t port)
Get the detected color saturation.
double pros::c::optical_get_brightness(uint8_t port)
Get the detected color brightness.
int32_t pros::c::optical_get_proximity(uint8_t port)
Get the detected proximity value.
int32_t pros::c::optical_set_led_pwm(uint8_t port, uint8_t value)
Set the pwm value of the White LED.
int32_t pros::c::optical_get_led_pwm(uint8_t port)
Get the pwm value of the White LED.
optical_rgb_s_t pros::c::optical_get_rgb(uint8_t port)
Get the processed RGBC data from the sensor.
optical_raw_s_t pros::c::optical_get_raw(uint8_t port)
Get the raw, unprocessed RGBC data from the sensor.
optical_direction_e_t pros::c::optical_get_gesture(uint8_t port)
Get the most recent gesture data from the sensor.
optical_gesture_s_t pros::c::optical_get_gesture_raw(uint8_t port)
Get the most recent raw gesture data from the sensor.
int32_t pros::c::optical_enable_gesture(uint8_t port)
Enable gesture detection on the sensor.
int32_t pros::c::optical_disable_gesture(uint8_t port)
Disable gesture detection on the sensor.
int32_t pros::c::vision_clear_led(uint8_t port)
Clears the vision sensor LED color, reseting it back to its default behavior, displaying the most prominent object signature color.
vision_signature_s_t pros::c::vision_signature_from_utility(const int32_t id, const int32_t u_min, const int32_t u_max, const int32_t u_mean, const int32_t v_min, const int32_t v_max, const int32_t v_mean, const float range, const int32_t type)
Creates a signature from the vision sensor utility.
vision_color_code_t pros::c::vision_create_color_code(uint8_t port, const uint32_t sig_id1, const uint32_t sig_id2, const uint32_t sig_id3, const uint32_t sig_id4, const uint32_t sig_id5)
Creates a color code that represents a combination of the given signature IDs.
vision_object_s_t pros::c::vision_get_by_size(uint8_t port, const uint32_t size_id)
Gets the nth largest object according to size_id.
vision_object_s_t pros::c::vision_get_by_sig(uint8_t port, const uint32_t size_id, const uint32_t sig_id)
Gets the nth largest object of the given signature according to size_id.
vision_object_s_t pros::c::vision_get_by_code(uint8_t port, const uint32_t size_id, const vision_color_code_t color_code)
Gets the nth largest object of the given color code according to size_id.
int32_t pros::c::vision_get_exposure(uint8_t port)
Gets the exposure parameter of the Vision Sensor.
int32_t pros::c::vision_get_object_count(uint8_t port)
Gets the number of objects currently detected by the Vision Sensor.
int32_t pros::c::vision_get_white_balance(uint8_t port)
Get the white balance parameter of the Vision Sensor.
int32_t pros::c::vision_print_signature(const vision_signature_s_t sig)
Prints the contents of the signature as an initializer list to the terminal.
int32_t pros::c::vision_read_by_size(uint8_t port, const uint32_t size_id, const uint32_t object_count, vision_object_s_t*const object_arr)
Reads up to object_count object descriptors into object_arr.
int32_t pros::c::vision_read_by_sig(uint8_t port, const uint32_t size_id, const uint32_t sig_id, const uint32_t object_count, vision_object_s_t*const object_arr)
Reads up to object_count object descriptors into object_arr.
int32_t pros::c::vision_read_by_code(uint8_t port, const uint32_t size_id, const vision_color_code_t color_code, const uint32_t object_count, vision_object_s_t*const object_arr)
Reads up to object_count object descriptors into object_arr.
vision_signature_s_t pros::c::vision_get_signature(uint8_t port, const uint8_t signature_id)
Gets the object detection signature with the given id number.
int32_t pros::c::vision_set_signature(uint8_t port, const uint8_t signature_id, vision_signature_s_t*const signature_ptr)
Stores the supplied object detection signature onto the vision sensor.
int32_t pros::c::vision_set_auto_white_balance(uint8_t port, const uint8_t enable)
Enables/disables auto white-balancing on the Vision Sensor.
int32_t pros::c::vision_set_exposure(uint8_t port, const uint8_t exposure)
Sets the exposure parameter of the Vision Sensor.
int32_t pros::c::vision_set_led(uint8_t port, const int32_t rgb)
Sets the vision sensor LED color, overriding the automatic behavior.
int32_t pros::c::vision_set_white_balance(uint8_t port, const int32_t rgb)
Sets the white balance parameter of the Vision Sensor.
int32_t pros::c::vision_set_zero_point(uint8_t port, vision_zero_e_t zero_point)
Sets the (0,0) coordinate for the Field of View.
int32_t pros::c::vision_set_wifi_mode(uint8_t port, const uint8_t enable)
Sets the Wi-Fi mode of the Vision sensor.

Screen Graphical Display Functions

These functions allow programmers to display shapes on the v5 screen

uint32_t pros::c::screen_set_pen(uint32_t color)
Set the pen color for subsequent graphics operations.
uint32_t pros::c::screen_set_eraser(uint32_t color)
Set the eraser color for erasing and the current background.
uint32_t pros::c::screen_get_pen(void)
Get the current pen color.
uint32_t pros::c::screen_get_eraser(void)
Get the current eraser color.
uint32_t pros::c::screen_erase(void)
Clear display with eraser color.
uint32_t pros::c::screen_scroll(int16_t start_line, int16_t lines)
Scroll lines on the display upwards.
uint32_t pros::c::screen_scroll_area(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t lines)
Scroll lines within a region on the display.
uint32_t pros::c::screen_copy_area(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint32_t* buf, int32_t stride)
Copy a screen region (designated by a rectangle) from an off-screen buffer to the screen.
uint32_t pros::c::screen_draw_pixel(int16_t x, int16_t y)
Draw a single pixel on the screen using the current pen color.
uint32_t pros::c::screen_erase_pixel(int16_t x, int16_t y)
Erase a pixel from the screen (Sets the location)
uint32_t pros::c::screen_draw_line(int16_t x0, int16_t y0, int16_t x1, int16_t y1)
Draw a line on the screen using the current pen color.
uint32_t pros::c::screen_erase_line(int16_t x0, int16_t y0, int16_t x1, int16_t y1)
Erase a line on the screen using the current eraser color.
uint32_t pros::c::screen_draw_rect(int16_t x0, int16_t y0, int16_t x1, int16_t y1)
Draw a rectangle on the screen using the current pen color.
uint32_t pros::c::screen_erase_rect(int16_t x0, int16_t y0, int16_t x1, int16_t y1)
Erase a rectangle on the screen using the current eraser color.
uint32_t pros::c::screen_fill_rect(int16_t x0, int16_t y0, int16_t x1, int16_t y1)
Fill a rectangular region of the screen using the current pen color.
uint32_t pros::c::screen_draw_circle(int16_t x, int16_t y, int16_t radius)
Draw a circle on the screen using the current pen color.
uint32_t pros::c::screen_erase_circle(int16_t x, int16_t y, int16_t radius)
Erase a circle on the screen using the current eraser color.
uint32_t pros::c::screen_fill_circle(int16_t x, int16_t y, int16_t radius)
Fill a circular region of the screen using the current pen color.

Screen Text Display Functions

These functions allow programmers to display text on the v5 screen

uint32_t pros::c::screen_print(text_format_e_t txt_fmt, const int16_t line, const char* text, ...)
Print a formatted string to the screen on the specified line.
uint32_t pros::c::screen_print_at(text_format_e_t txt_fmt, const int16_t x, const int16_t y, const char* text, ...)
Print a formatted string to the screen at the specified point.
uint32_t pros::c::screen_vprintf(text_format_e_t txt_fmt, const int16_t line, const char* text, va_list args)
Print a formatted string to the screen on the specified line.
uint32_t pros::c::screen_vprintf_at(text_format_e_t txt_fmt, const int16_t x, const int16_t y, const char* text, va_list args)
Print a formatted string to the screen at the specified coordinates.

Screen Touch Functions

These functions allow programmers to access information about screen touches

screen_touch_status_s_t pros::c::screen_touch_status(void)
Gets the touch status of the last touch of the screen.
uint32_t pros::c::screen_touch_callback(touch_event_cb_fn_t cb, last_touch_e_t event_type)
Assigns a callback function to be called when a certain touch event happens.

Serial communication functions

These functions allow programmers to communicate using UART over RS485

int32_t pros::c::serial_enable(uint8_t port)
Enables generic serial on the given port.
int32_t pros::c::serial_set_baudrate(uint8_t port, int32_t baudrate)
Sets the baudrate for the serial port to operate at.
int32_t pros::c::serial_flush(uint8_t port)
Clears the internal input and output FIFO buffers.
int32_t pros::c::serial_get_read_avail(uint8_t port)
Returns the number of bytes available to be read in the the port's FIFO input buffer.
int32_t pros::c::serial_get_write_free(uint8_t port)
Returns the number of bytes free in the port's FIFO output buffer.
int32_t pros::c::serial_peek_byte(uint8_t port)
Reads the next byte avaliable in the port's input buffer without removing it.
int32_t pros::c::serial_read_byte(uint8_t port)
Reads the next byte avaliable in the port's input buffer.
int32_t pros::c::serial_read(uint8_t port, uint8_t* buffer, int32_t length)
Reads up to the next length bytes from the port's input buffer and places them in the user supplied buffer.
int32_t pros::c::serial_write_byte(uint8_t port, uint8_t buffer)
Write the given byte to the port's output buffer.
int32_t pros::c::serial_write(uint8_t port, uint8_t* buffer, int32_t length)
Writes up to length bytes from the user supplied buffer to the port's output buffer.

Enums

enum color_e { COLOR_ALICE_BLUE = 0x00F0F8FF, COLOR_ANTIQUE_WHITE = 0x00FAEBD7, COLOR_AQUA = 0x0000FFFF, COLOR_AQUAMARINE = 0x007FFFD4, COLOR_AZURE = 0x00F0FFFF, COLOR_BEIGE = 0x00F5F5DC, COLOR_BISQUE = 0x00FFE4C4, COLOR_BLACK = 0x00000000, COLOR_BLANCHED_ALMOND = 0x00FFEBCD, COLOR_BLUE = 0x000000FF, COLOR_BLUE_VIOLET = 0x008A2BE2, COLOR_BROWN = 0x00A52A2A, COLOR_BURLY_WOOD = 0x00DEB887, COLOR_CADET_BLUE = 0x005F9EA0, COLOR_CHARTREUSE = 0x007FFF00, COLOR_CHOCOLATE = 0x00D2691E, COLOR_CORAL = 0x00FF7F50, COLOR_CORNFLOWER_BLUE = 0x006495ED, COLOR_CORNSILK = 0x00FFF8DC, COLOR_CRIMSON = 0x00DC143C, COLOR_CYAN = 0x0000FFFF, COLOR_DARK_BLUE = 0x0000008B, COLOR_DARK_CYAN = 0x00008B8B, COLOR_DARK_GOLDENROD = 0x00B8860B, COLOR_DARK_GRAY = 0x00A9A9A9, COLOR_DARK_GREY = COLOR_DARK_GRAY, COLOR_DARK_GREEN = 0x00006400, COLOR_DARK_KHAKI = 0x00BDB76B, COLOR_DARK_MAGENTA = 0x008B008B, COLOR_DARK_OLIVE_GREEN = 0x00556B2F, COLOR_DARK_ORANGE = 0x00FF8C00, COLOR_DARK_ORCHID = 0x009932CC, COLOR_DARK_RED = 0x008B0000, COLOR_DARK_SALMON = 0x00E9967A, COLOR_DARK_SEA_GREEN = 0x008FBC8F, COLOR_DARK_SLATE_GRAY = 0x002F4F4F, COLOR_DARK_SLATE_GREY = COLOR_DARK_SLATE_GRAY, COLOR_DARK_TURQUOISE = 0x0000CED1, COLOR_DARK_VIOLET = 0x009400D3, COLOR_DEEP_PINK = 0x00FF1493, COLOR_DEEP_SKY_BLUE = 0x0000BFFF, COLOR_DIM_GRAY = 0x00696969, COLOR_DIM_GREY = COLOR_DIM_GRAY, COLOR_DODGER_BLUE = 0x001E90FF, COLOR_FIRE_BRICK = 0x00B22222, COLOR_FLORAL_WHITE = 0x00FFFAF0, COLOR_FOREST_GREEN = 0x00228B22, COLOR_FUCHSIA = 0x00FF00FF, COLOR_GAINSBORO = 0x00DCDCDC, COLOR_GHOST_WHITE = 0x00F8F8FF, COLOR_GOLD = 0x00FFD700, COLOR_GOLDENROD = 0x00DAA520, COLOR_GRAY = 0x00808080, COLOR_GREY = COLOR_GRAY, COLOR_GREEN = 0x00008000, COLOR_GREEN_YELLOW = 0x00ADFF2F, COLOR_HONEYDEW = 0x00F0FFF0, COLOR_HOT_PINK = 0x00FF69B4, COLOR_INDIAN_RED = 0x00CD5C5C, COLOR_INDIGO = 0x004B0082, COLOR_IVORY = 0x00FFFFF0, COLOR_KHAKI = 0x00F0E68C, COLOR_LAVENDER = 0x00E6E6FA, COLOR_LAVENDER_BLUSH = 0x00FFF0F5, COLOR_LAWN_GREEN = 0x007CFC00, COLOR_LEMON_CHIFFON = 0x00FFFACD, COLOR_LIGHT_BLUE = 0x00ADD8E6, COLOR_LIGHT_CORAL = 0x00F08080, COLOR_LIGHT_CYAN = 0x00E0FFFF, COLOR_LIGHT_GOLDENROD_YELLOW = 0x00FAFAD2, COLOR_LIGHT_GREEN = 0x0090EE90, COLOR_LIGHT_GRAY = 0x00D3D3D3, COLOR_LIGHT_GREY = COLOR_LIGHT_GRAY, COLOR_LIGHT_PINK = 0x00FFB6C1, COLOR_LIGHT_SALMON = 0x00FFA07A, COLOR_LIGHT_SEA_GREEN = 0x0020B2AA, COLOR_LIGHT_SKY_BLUE = 0x0087CEFA, COLOR_LIGHT_SLATE_GRAY = 0x00778899, COLOR_LIGHT_SLATE_GREY = COLOR_LIGHT_SLATE_GRAY, COLOR_LIGHT_STEEL_BLUE = 0x00B0C4DE, COLOR_LIGHT_YELLOW = 0x00FFFFE0, COLOR_LIME = 0x0000FF00, COLOR_LIME_GREEN = 0x0032CD32, COLOR_LINEN = 0x00FAF0E6, COLOR_MAGENTA = 0x00FF00FF, COLOR_MAROON = 0x00800000, COLOR_MEDIUM_AQUAMARINE = 0x0066CDAA, COLOR_MEDIUM_BLUE = 0x000000CD, COLOR_MEDIUM_ORCHID = 0x00BA55D3, COLOR_MEDIUM_PURPLE = 0x009370DB, COLOR_MEDIUM_SEA_GREEN = 0x003CB371, COLOR_MEDIUM_SLATE_BLUE = 0x007B68EE, COLOR_MEDIUM_SPRING_GREEN = 0x0000FA9A, COLOR_MEDIUM_TURQUOISE = 0x0048D1CC, COLOR_MEDIUM_VIOLET_RED = 0x00C71585, COLOR_MIDNIGHT_BLUE = 0x00191970, COLOR_MINT_CREAM = 0x00F5FFFA, COLOR_MISTY_ROSE = 0x00FFE4E1, COLOR_MOCCASIN = 0x00FFE4B5, COLOR_NAVAJO_WHITE = 0x00FFDEAD, COLOR_NAVY = 0x00000080, COLOR_OLD_LACE = 0x00FDF5E6, COLOR_OLIVE = 0x00808000, COLOR_OLIVE_DRAB = 0x006B8E23, COLOR_ORANGE = 0x00FFA500, COLOR_ORANGE_RED = 0x00FF4500, COLOR_ORCHID = 0x00DA70D6, COLOR_PALE_GOLDENROD = 0x00EEE8AA, COLOR_PALE_GREEN = 0x0098FB98, COLOR_PALE_TURQUOISE = 0x00AFEEEE, COLOR_PALE_VIOLET_RED = 0x00DB7093, COLOR_PAPAY_WHIP = 0x00FFEFD5, COLOR_PEACH_PUFF = 0x00FFDAB9, COLOR_PERU = 0x00CD853F, COLOR_PINK = 0x00FFC0CB, COLOR_PLUM = 0x00DDA0DD, COLOR_POWDER_BLUE = 0x00B0E0E6, COLOR_PURPLE = 0x00800080, COLOR_RED = 0x00FF0000, COLOR_ROSY_BROWN = 0x00BC8F8F, COLOR_ROYAL_BLUE = 0x004169E1, COLOR_SADDLE_BROWN = 0x008B4513, COLOR_SALMON = 0x00FA8072, COLOR_SANDY_BROWN = 0x00F4A460, COLOR_SEA_GREEN = 0x002E8B57, COLOR_SEASHELL = 0x00FFF5EE, COLOR_SIENNA = 0x00A0522D, COLOR_SILVER = 0x00C0C0C0, COLOR_SKY_BLUE = 0x0087CEEB, COLOR_SLATE_BLUE = 0x006A5ACD, COLOR_SLATE_GRAY = 0x00708090, COLOR_SLATE_GREY = COLOR_SLATE_GRAY, COLOR_SNOW = 0x00FFFAFA, COLOR_SPRING_GREEN = 0x0000FF7F, COLOR_STEEL_BLUE = 0x004682B4, COLOR_TAN = 0x00D2B48C, COLOR_TEAL = 0x00008080, COLOR_THISTLE = 0x00D8BFD8, COLOR_TOMATO = 0x00FF6347, COLOR_TURQUOISE = 0x0040E0D0, COLOR_VIOLET = 0x00EE82EE, COLOR_WHEAT = 0x00F5DEB3, COLOR_WHITE = 0x00FFFFFF, COLOR_WHITE_SMOKE = 0x00F5F5F5, COLOR_YELLOW = 0x00FFFF00, COLOR_YELLOW_GREEN = 0x009ACD32 }
enum v5_device_e { E_DEVICE_NONE = 0, E_DEVICE_MOTOR = 2, E_DEVICE_ROTATION = 4, E_DEVICE_IMU = 6, E_DEVICE_DISTANCE = 7, E_DEVICE_RADIO = 8, E_DEVICE_VISION = 11, E_DEVICE_ADI = 12, E_DEVICE_OPTICAL = 16, E_DEVICE_GPS = 20, E_DEVICE_SERIAL = 129, __attribute__ =((deprecated("use E_DEVICE_SERIAL instead"))) = E_DEVICE_SERIAL, E_DEVICE_UNDEFINED = 255 }
List of possible v5 devices.
enum optical_direction_e { NO_GESTURE = 0, UP = 1, DOWN = 2, RIGHT = 3, LEFT = 4, ERROR = PROS_ERR }

Typedefs

using adi_encoder_t = int32_t
Reference type for an initialized encoder.
using adi_ultrasonic_t = int32_t
Reference type for an initialized ultrasonic.
using adi_gyro_t = int32_t
Reference type for an initialized gyroscope.
using adi_potentiometer_t = int32_t
Reference type for an initialized potentiometer.
using adi_led_t = int32_t
Reference type for an initialized addressable led.
using ext_adi_encoder_t = int32_t
Reference type for an initialized encoder.
using ext_adi_ultrasonic_t = int32_t
Reference type for an initialized ultrasonic.
using ext_adi_gyro_t = int32_t
Reference type for an initialized gyroscope.
using ext_adi_potentiometer_t = int32_t
Reference type for an initialized potentiometer.
using ext_adi_led_t = int32_t
Reference type for an initialized addressable led.

Variables

bool const char* fmt
const char* baked_date
Date and Time
const char* baked_time

Function documentation

bool pros::c::__attribute__((weak)) lcd_print(int16_t line

Displays a formatted string on the emulated three-button LCD screen.

Returns True if the operation was successful, or false otherwise, setting errno values as specified above.

This function uses the following values of errno when an error state is reached: ENXIO - The LCD has not been initialized. Call lcd_initialize() first. EINVAL - The line number specified is not in the range [0-7]

int32_t pros::c::motor_set_zero_position(int8_t port, const double position)

Sets the position for the motor in its encoder units.

Parameters
port The V5 port number from 1 to 21, or from -21 to -1 for reversed motors
position The new reference position in its encoder units
Returns 1 if the operation was successful or PROS_ERR if the operation failed, setting errno.

This will be the future reference point for the motor's "absolute" position.

This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports |1-21|. ENODEV - The port cannot be configured as a motor

Example

void autonomous() {
  motor_move_absolute(1, 100, 100); // Moves 100 units forward
  while (!((motor_get_position(1) - 100 < 105) && (motor_get_position(1) - 100 > 95))) {
    // Continue running this loop as long as the motor is not within +-5 units of its goal
    delay(2);
  }
  motor_move_absolute(1, 100, 100); // This does not cause a movement
  while (!((motor_get_position(1) - 100 < 105) && (motor_get_position(1) - 100 > 95))) {
    delay(2);
  }

  motor_set_zero_position(1, 80);
  motor_move_absolute(1, 100, 100); // Moves 80 units forward
  while (!((motor_get_position(1) - 100 < 105) && (motor_get_position(1) - 100 > 95))) {
    delay(2);
  }
}

int32_t pros::c::motor_tare_position(int8_t port)

Sets the "absolute" zero position of the motor to its current position.

Parameters
port The V5 port number from 1 to 21, or from -21 to -1 for reversed motors
Returns 1 if the operation was successful or PROS_ERR if the operation failed, setting errno.

This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports |1-21|. ENODEV - The port cannot be configured as a motor

Example

void autonomous() {
  motor_move_absolute(1, 100, 100); // Moves 100 units forward
  while (!((motor_get_position(1) - 100 < 105) && (motor_get_position(1) - 100 > 95))) {
    // Continue running this loop as long as the motor is not within +-5 units of its goal
    delay(2);
  }
  motor_move_absolute(1, 100, 100); // This does not cause a movement
  while (!((motor_get_position(1) - 100 < 105) && (motor_get_position(1) - 100 > 95))) {
    delay(2);
  }

  motor_tare_position(1);
  motor_move_absolute(1, 100, 100); // Moves 100 units forward
  while (!((motor_get_position(1) - 100 < 105) && (motor_get_position(1) - 100 > 95))) {
    delay(2);
  }
}

int32_t pros::c::motor_set_brake_mode(int8_t port, const motor_brake_mode_e_t mode)

Sets one of motor_brake_mode_e_t to the motor.

Parameters
port The V5 port number from 1 to 21, or from -21 to -1 for reversed motors
mode The motor_brake_mode_e_t to set for the motor
Returns 1 if the operation was successful or PROS_ERR if the operation failed, setting errno.

This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports |1-21|. ENODEV - The port cannot be configured as a motor

Example

void initialize() {
  motor_set_brake_mode(1, E_MOTOR_BRAKE_HOLD);
  printf("Brake Mode: %d\n", motor_get_brake_mode(1));
}

int32_t pros::c::motor_set_current_limit(int8_t port, const int32_t limit)

Sets the current limit for the motor in mA.

Parameters
port The V5 port number from 1 to 21, or from -21 to -1 for reversed motors
limit The new current limit in mA
Returns 1 if the operation was successful or PROS_ERR if the operation failed, setting errno.

This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports |1-21|. ENODEV - The port cannot be configured as a motor

Example

void opcontrol() {
  motor_set_current_limit(1, 1000);
  while (true) {
    motor_move(1, controller_get_analog(E_CONTROLLER_MASTER, E_CONTROLLER_ANALOG_LEFT_Y));
    // The motor will reduce its output at 1000 mA instead of the default 2500 mA
    delay(2);
  }
}

int32_t pros::c::motor_set_encoder_units(int8_t port, const motor_encoder_units_e_t units)

Sets one of motor_encoder_units_e_t for the motor encoder.

Parameters
port The V5 port number from 1 to 21, or from -21 to -1 for reversed motors
units The new motor encoder units
Returns 1 if the operation was successful or PROS_ERR if the operation failed, setting errno.

This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports |1-21|. ENODEV - The port cannot be configured as a motor

Example

void initialize() {
  motor_set_encoder_units(1, E_MOTOR_ENCODER_DEGREES);
  printf("Encoder Units: %d\n", motor_get_encoder_units(1));
}

int32_t pros::c::motor_set_gearing(int8_t port, const motor_gearset_e_t gearset)

Sets one of motor_gearset_e_t for the motor.

Parameters
port The V5 port number from 1 to 21, or from -21 to -1 for reversed motors
gearset The new motor gearset
Returns 1 if the operation was successful or PROS_ERR if the operation failed, setting errno.

This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports |1-21|. ENODEV - The port cannot be configured as a motor

Example

void initialize() {
  motor_set_gearing(1, E_MOTOR_GEARSET_06);
  printf("Brake Mode: %d\n", motor_get_gearing(1));
}

int32_t pros::c::motor_set_voltage_limit(int8_t port, const int32_t limit)

Sets the voltage limit for the motor in Volts.

Parameters
port The V5 port number from 1 to 21, or from -21 to -1 for reversed motors
limit The new voltage limit in Volts
Returns 1 if the operation was successful or PROS_ERR if the operation failed, setting errno.

This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports |1-21|. ENODEV - The port cannot be configured as a motor

Example

void autonomous() {
  motor_set_voltage_limit(1, 10000);
  while (true) {
    motor_move(1, controller_get_analog(E_CONTROLLER_MASTER, E_CONTROLLER_ANALOG_LEFT_Y));
    // The motor will not output more than 10 V
    delay(2);
  }
}

motor_brake_mode_e_t pros::c::motor_get_brake_mode(int8_t port)

Gets the brake mode that was set for the motor.

Parameters
port The V5 port number from 1 to 21, or from -21 to -1 for reversed motors
Returns One of motor_brake_mode_e_t, according to what was set for the motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno.

This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports |1-21|. ENODEV - The port cannot be configured as a motor

Example

void initialize() {
  motor_set_brake_mode(1, E_MOTOR_BRAKE_HOLD);
  printf("Brake Mode: %d\n", motor_get_brake_mode(1));
}

int32_t pros::c::motor_get_current_limit(int8_t port)

Gets the current limit for the motor in mA.

Parameters
port The V5 port number from 1 to 21, or from -21 to -1 for reversed motors
Returns The motor's current limit in mA or PROS_ERR if the operation failed, setting errno.

The default value is 2500 mA.

This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports |1-21|. ENODEV - The port cannot be configured as a motor

Example

void initialize() {
  printf("Motor Current Limit: %d\n", motor_get_current_limit(1));
  // Prints "Motor Current Limit: 2500"
}

motor_encoder_units_e_t pros::c::motor_get_encoder_units(int8_t port)

Gets the encoder units that were set for the motor.

Parameters
port The V5 port number from 1 to 21, or from -21 to -1 for reversed motors
Returns One of motor_encoder_units_e_t according to what is set for the motor or E_MOTOR_ENCODER_INVALID if the operation failed.

This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports |1-21|. ENODEV - The port cannot be configured as a motor

motor_gearset_e_t pros::c::motor_get_gearing(int8_t port)

Gets the gearset that was set for the motor.

Parameters
port The V5 port number from 1 to 21, or from -21 to -1 for reversed motors
Returns One of motor_gearset_e_t according to what is set for the motor, or E_GEARSET_INVALID if the operation failed.

This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports |1-21|. ENODEV - The port cannot be configured as a motor

Example

void initialize() {
  printf("Motor Encoder Units: %d\n", motor_get_encoder_units(1));
  // Prints E_MOTOR_ENCODER_DEGREES by default
}

int32_t pros::c::motor_get_voltage_limit(int8_t port)

Gets the voltage limit set by the user.

Parameters
port The V5 port number from 1 to 21, or from -21 to -1 for reversed motors
Returns The motor's voltage limit in V or PROS_ERR if the operation failed, setting errno.

Default value is 0V, which means that there is no software limitation imposed on the voltage.

This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports |1-21|. ENODEV - The port cannot be configured as a motor

Example

void initialize() {
  printf("Motor Voltage Limit: %d\n", motor_get_voltage_limit(1));
  // Prints 0 by default, indicating no limit
}

Variable documentation

bool const char* pros::c::fmt