Pantalla#

Introducción#

The screen class is derived from the controller base class, which controls the V5 controller’s touchscreen, allowing your robot to show text and numbers.

La pantalla del controlador tiene 3 filas y 19 columnas para imprimir.

Acceso#

The screen class can be accessed by:

Controller.Screen

Notas#

  • The screen object is provided by the controller. It is not constructed directly.

Ejemplo#

/* This constructor is required when using VS Code.
A controller is generated automatically at the start of
VEXcode projects. */

// Create the V5 Controller
controller Controller1 = controller(primary);

// Print text to the Controller screen
Controller.Screen.print("Hello!");

Funciones de los miembros#

The screen class includes the following member functions:

  • print — Prints formatted text, numbers, or Boolean values to the controller’s screen.

  • setCursor — Sets the text cursor to a specified row and column.

  • newLine — Clears the remainder of the current line and moves the cursor to the next line.

  • clearScreen — Clears the the entire screen.

  • clearLine — Clears the remainder of the current line or clears a specified line.

  • row — Returns the current cursor row.

  • column — Returns the current cursor column.

Before calling any screen member functions, a controller instance must be created, as shown below:

// Create a V5 controller instance
controller Controller = controller();

imprimir#

Muestra texto, números o valores booleanos en la pantalla del controlador V5.

Available Functions

1 Imprime texto formateado usando literales de cadena o cadenas de estilo C de solo lectura.

void print(
    const char* format,
    ... );

2 Imprime texto formateado utilizando matrices de caracteres modificables.

void print(
    char* format,
    ... );

Parameters

Parámetro

Tipo

Descripción

format

const char*

A format string provided as a string literal or read-only C-style string (for example, “Score: %d”).

format

char*

Una cadena de formato proporcionada como una matriz de caracteres modificable.

Uno o más valores adicionales que se insertan en la cadena de formato, separados por comas.

Return Values

Esta función no devuelve ningún valor.

Notes Examples
// Display a message at the starting cursor
Controller.Screen.print("Hello, Robot!");

establecer cursor#

Establece la posición del cursor en la pantalla del controlador V5 en la fila y columna especificadas.

Available Functions
void setCursor(
  int32_t row, 
  int32_t col );

Parameters

Parámetro

Tipo

Descripción

row

int32_t

El número de fila donde se colocará el cursor.

col

int32_t

El número de columna donde se colocará el cursor.

Return Values

Esta función no devuelve ningún valor.

Notes
  • Afecta al punto donde comienza la salida de texto posterior al usar print.

  • Calling setCursor affects the position of subsequent text output only.

Examples
// Display text starting at Row 2 Column 3
Controller.Screen.setCursor(2, 3);
Controller.Screen.print("Row 2, Column 3");

nueva línea#

Mueve el cursor al principio de la siguiente fila en la pantalla del controlador.

Available Functions
void newLine();

Parameters

Esta función no acepta ningún parámetro.

Return Values

Esta función no devuelve ningún valor.

Notes
  • If the cursor is in the middle of a sentence, newLine will clear the rest of the row after the cursor before moving to the next row.

  • After calling newLine, the cursor is positioned at the first column of the next line.

  • La posición del cursor y la numeración de las filas se establecen mediante setCursor.

Examples
// Display two lines of text
Controller.Screen.print("Line 1");
Controller.Screen.newLine();
Controller.Screen.print("Line 2");

pantalla clara#

Borra todo el texto de la pantalla del mando.

Available Functions
void clearScreen();

Parameters

Esta función no acepta ningún parámetro.

Return Values

Esta función no devuelve ningún valor.

Examples
// Clear screen after 2 seconds
Controller.Screen.print("VEXcode");
wait(2, seconds);
Controller.Screen.clearScreen();

Línea clara#

Borra el texto de una fila en la pantalla del controlador V5.

Available Functions

1 Borra la fila especificada en la pantalla.

void clearLine(
    int line );

2 Borra la fila actual en la pantalla.

void clearLine();

Parameters

Parámetro

Tipo

Descripción

line

int

La línea que se va a borrar va de la 1 a la 3. Si no se especifica, se borrará la línea actual.

Return Values

Esta función no devuelve ningún valor.

Notes
  • Borrar una línea no cambia la posición actual del cursor.

  • La posición del cursor y la numeración de las filas se establecen mediante setCursor.

Examples
// Display text on two rows
Controller.Screen.print("This text stays");
Controller.Screen.newLine();
Controller.Screen.print("This disappears");

// Wait 3 seconds before clearing row 2
wait(3, seconds);
Controller.Screen.clearLine(2);

fila#

Devuelve la posición actual del cursor en la fila de la pantalla del controlador V5.

Available Functions
int32_t row();

Parameters

Esta función no acepta ningún parámetro.

Return Values

Returns an int32_t representing the current cursor row position.

La numeración de las filas comienza en el 1.

Notes
  • El valor devuelto indica dónde aparecerá la siguiente impresión.

  • El valor de la fila cambia cuando se imprime texto o cuando se llama a setCursor.

Examples
// Display the cursor's current row
Controller.Screen.setCursor(3, 2);
Controller.Screen.print(Controller.Screen.row());

columna#

Devuelve la posición actual del cursor en la columna de la pantalla del controlador V5.

Available Functions
int32_t column();

Parameters

Esta función no acepta ningún parámetro.

Return Values

Returns an int32_t representing the current cursor column position.

La numeración de las columnas comienza en 1.

Notes
  • El valor devuelto indica dónde aparecerá la siguiente impresión.

  • El valor de la columna cambia cuando se imprime texto o cuando se llama a setCursor.

Examples
// Display the cursor's current column
Controller.Screen.setCursor(3, 2);
Controller.Screen.print(Controller.Screen.column());